Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.36k stars 1.55k forks source link

vfx.loop doesn't work with clips with audio #659

Open Swend5 opened 6 years ago

Swend5 commented 6 years ago

This code should loop a clip to double the length and write that to a file.

from moviepy.editor import *
clip = VideoFileClip("sample.mp4").fx(vfx.loop, n = 2)
clip.write_videofile("output.mp4")

But it returns an error.

OSError: Error in file sample.mp4, Accessing time t=5.58-5.62 seconds,
with clip duration=5 seconds,

Duration of the clip is 5.57 before looping and 11.14 after. Curiously the duration of the clips audio goes from 5.57 to 22.28 instead. There are no issues if I use without_audio, and no issues without vfx.loop. The problem can be circumvented by concatenating the clip with itself, but I don't know what problems that might cause.

Sample I used is this: http://techslides.com/demos/samples/sample.mp4

tburrows13 commented 6 years ago

Sorry it’s a bit late, there shouldn’t be any issues with concatenating the video with itself. I’ll try and have a look at this issue soon.

osfa commented 5 years ago

I have the exact same problem and error but using "concatenate_videoclips()"

OSError: Error in file myfile.mp4, Accessing time t=6.43-6.47 seconds, with clip duration=6 seconds

I also have no issues if I use without_audio