Zulko / moviepy

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

concatenating videoclips result in laggy result video #1671

Open coralexbadea opened 2 years ago

coralexbadea commented 2 years ago

Expected Behavior

For short videoclips concatenation the resulted video is smooth containing all composing videos.

Actual Behavior

The resulting video has lag between the composing parts, some of the parts being completly missing and replaced with the freezed last frame of the previous composing video.

We can see the results in the following amv video: https://www.youtube.com/watch?v=3ksI-EIphXY

Steps to Reproduce the Problem

I have the following code:

beginTime = 10
endTime = beginTime + intervals[0]
for c,i in enumerate(intervals[1:-1]):
  print(f"beginTime{beginTime}")
  print(f"endTime{endTime}")
  output = "./sample%d.mp4" % (c)
  ffmpeg_extract_subclip(videoPath, beginTime, endTime, output)
  #beginTime = randint(intro_duration ,maxVideoDur) 
  beginTime = endTime + randint(1, maxRand) 
  endTime = beginTime + i 

L =[]
for root, dirs, files in os.walk("./"):
    #files = natsorted(files)
    for file in files:
        if os.path.splitext(file)[1] == '.mp4':
            filePath = os.path.join(root, file)
            video = VideoFileClip(filePath)
            L.append(video)

video = concatenate_videoclips(L)
video.to_videofile("./video/output.mp4", fps=30)

Specifications

yemibox51 commented 2 years ago

What dependencies or packages do you have installed?