简体   繁体   中英

Error with the output when using moviepy module to concatenate video files

I am trying to use moviepy to join some video clips together, I get the output, with the files joined as expected. When watching the final video, clip1 looks as expected but clip2 has an error, see image. 在此处输入图片说明 All resources I have looked at show that the way the code I have written should work, so am unure what I could do to solve the issue. Any suggestion would be amazing!

The code that I used

filenames = ['clip1.mp4', 'clip2.mp4', 'clip3.mp4']

for x in range(len(filenames)):
    filenames[x] = VideoFileClip(filenames[x])

final_video = concatenate_videoclips(filenames)
final_video.to_videofile("final_video.mp4", fps=30, codec="mpeg4")

Try this instead:

filenames = ['clip1.mp4', 'clip2.mp4', 'clip3.mp4']

clips = []

for file in filenames:
    clips.append(VideoFileClip(file))

final_video = concatenate_videoclips(clips, method=compose)
final_video.write_videofile('final_video.mp4', fps=30)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM