Search code snippets, questions, articles...

Join two videos using moviepy in Python

from moviepy.editor import VideoFileClip, concatenate_videoclips

video_1 = VideoFileClip("path/to/first/video.mp4")
video_2 = VideoFileClip("path/to/second/video.mp4")

final_video= concatenate_videoclips([video_1, video_2], method="compose")

You can join or concatenate or join two videos in Python using moviepy package. You can install moviepy using pip by running below command

pip install moviepy

After installing moviepy you can import VideoFileClip and concatenate_videoclips from moviepy.editor which we will use to merge our videos. If you are merging videos that have different resolutions, don't forget to use method="compose" in concatenate_videoclips method.

Search Index Data (The code snippet can also be found with below search text)

concatenate videos python
Was this helpful?
Programming Feeds
Learn something new everyday on Devsheet