
The method parameter accepts two possible values: The concatenate() function we wrote accepts the list of video files ( video_clip_paths), the output video file path, and the method of joining.įirst, we loop over the list of video files and load them using VideoFileClip() object from MoviePy. # concatenate the final video with the compose method provided by moviepyįinal_clip = concatenate_videoclips(clips, method="compose") # calculate minimum width & height across all clipsįinal_clip = concatenate_videoclips(clips) # create VideoFileClip object for each video fileĬlips = `compose`: type help(concatenate_videoclips) for the info""" `reduce`: Reduce the quality of the video to the lowest quality on the list of `video_clip_paths`. `method` can be either 'compose' or 'reduce': Note that extension (mp4, etc.) must be added to `output_path` """Concatenates several video files into one video fileĪnd save it to `output_path`. Open up a new Python file and write the following code: def concatenate(video_clip_paths, output_path, method="compose"): MoviePy uses FFmpeg software under the hood and will install it once you execute MoviePy code the first time. To get started, let's install MoviePy first: $ pip install moviepy This tutorial is similar to the joining audio files tutorial, but we'll be joining videos in this one. In this tutorial, you will learn how to join two or more video files together using Python with the help of the MoviePy library. Disclosure: This post may contain affiliate links, meaning when you click the links and make a purchase, we receive a commission.
