Python Merge Two Videos to One Video with MoviePy: A Completed Guide – Python Tutorial

By | December 9, 2019

In python, we can use moviepy library to merge videos, which is very simple and easy to use. In this tutorial, we will write an example to illustrate you how to do.


We should install moviepy library first with pip command.

pip install moviepy

Import some libraries

We can import some python libraries before starting to merge videos.

from moviepy.editor import VideoFileClip, concatenate_videoclips

Define two videos

In this tutorial, we will merge two videos to a big video with python, we will define two videos first.

video_1 = VideoFileClip("VTS_26_1.mp4")
video_2 = VideoFileClip("VTS_27_1.mp4")

In code above, we use VideoFileClip() class create two video object, then we will merge them.

Merge videos

final_video= concatenate_videoclips([video_1, video_2])

Here we use concatenate_videoclips() to merge a video list, which means we can concatenate a serial of videos. Then, we will save these videos to a big video, which is named to final_video.mp4.

Run this python code, you will get process like:

Moviepy merge multi video to a video

Waiting for a moment, you will find that merging videos successfully.

Meanwhile, if you want to split a big video to some small videos, you can view this tutorial.

Best Practice to Python Clip Big Video to Small Video by Start Time and End Time – Python Tutorial


Leave a Reply

Your email address will not be published. Required fields are marked *