Exemple #1
0
def test_shallow_copy():
    """Call a function which uses @outplace
       and verify that making a shallow copy and deleting it
       does not corrupt the original clip."""
    video_file = "media/big_buck_bunny_0_30.webm"
    video = VideoFileClip(video_file)
    video_copy = video.set_start(1)
    del video_copy
    # The clip object buffers 200000 frames, around 5 seconds ahead.
    # When recentering the buffer, if the new buffer is more than 1000000 frames,
    # around 25s ahead of the end of the current buffer, the reader will
    # reinitialize and fix self.proc.
    # Thus to trigger the bug, you have to look for a frame between ~5 and ~30
    # seconds away. These numbers might vary for different reasons and it would
    # be nice to have a test which was robust to changes in default buffer size, etc.
    video.audio.make_frame(15)
Exemple #2
0
# sources
video = VideoFileClip("D:\\upload\\video.mp4").subclip(0, 6).add_mask()
video = video.resize(size)

foto1 = (ImageClip("D:\\upload\\foto1.png").set_duration(3))
foto1 = foto1.resize(size)

foto2 = (ImageClip("D:\\upload\\foto2.png").set_duration(3))
foto2 = foto2.resize(size)

foto3 = (ImageClip("D:\\upload\\fotoend.jpg").set_duration(2))
foto3 = foto3.resize(size)

num = video.duration + 3

numfin = num + 3

# creating the video
videofinal = CompositeVideoClip([
    foto1,  # starts at t=0
    video.set_start(3),
    foto2.set_start(num),
    foto3.set_start(numfin)
])

background_audio_clip = AudioFileClip("D:\\upload\\audio.mp3").subclip(0, 3)
bg_music = concatenate_audioclips([background_audio_clip, video.audio])

videofinal = videofinal.set_audio(bg_music)

videofinal.write_videofile("D:\\upload\\final.mp4")