1

Yeah, basically we want to join multiple videos like this: 1 + 1 + ...= 11... (1:video) sorry that's the best example i could come up with on the spot. and export them to be one video

Douglas
  • 21
  • 4

2 Answers2

4

Refer this Example:

from moviepy.editor import VideoFileClip, concatenate_videoclips

# Read files
vid1 = VideoFileClip("video1.mp4")
vid2 = VideoFileClip("video2.mp4")
vid3 = VideoFileClip("video3.mp4")

# Concat them
final = concatenate_videoclips([vid1, vid2, vid3])

# Write output to the file
final.write_videofile("newVideo.mp4")

Hope this helps you!

mujjiga
  • 16,186
  • 2
  • 33
  • 51
night vision
  • 124
  • 5
0

A had problems with the solution when tried to concatenate two .avi videos. I used the solution by 'night vision', to create not .avi, but mp4 instead, using mp4 codec

def concatenate_videos(list_videos,newname):
    
    from moviepy.editor import VideoFileClip, concatenate_videoclips

    concatinated = concatenate_videoclips([VideoFileClip(v) for v in list_videos])

    concatinated.write_videofile(newname + '.mp4', codec='libx264')
LetzerWille
  • 5,355
  • 4
  • 23
  • 26