10/20/2025

Discover the fastest ways to merge multiple video files with FFmpeg. Learn both the lossless method for identical formats and the robust filter method for joining any clips.

How to Merge (Concatenate) Videos with FFmpeg: From Lossless to Universal

Do you have a sequence of video clips (clip1.mp4, clip2.mp4, clip3.mp4) that you want to join into a single, seamless video? FFmpeg offers several powerful methods to do this, including an incredibly fast technique that doesn't even require re-encoding.

This guide covers the two most essential methods for merging videos.

🚀 Quick Path: Method 1 (Lossless Concatenation)

When to use it: When all your video clips have the exact same codecs, resolution, and frame rate (e.g., they are sequential clips from the same camera or phone).

This method is lightning-fast because it directly concatenates the data streams without re-encoding, thus preserving the original quality.

Step 1: Create a text file

First, create a text file, for example mylist.txt, with the following content:

file 'clip1.mp4'
file 'clip2.mp4'
file 'clip3.mp4'

Step 2: Run the FFmpeg command

Next, run the following command in your terminal:

ffmpeg -f concat -safe 0 -i mylist.txt -c copy final_video.mp4

🧠 The Breakdown: What Each Parameter Means

Parameter Explanation
ffmpeg Starts the FFmpeg program.
-f concat -f (format) forces the input format to use the concat demuxer, which is the key to this lossless method.
-safe 0 This is a security option that allows the use of relative or absolute file paths in your list file. It's required for simple filenames.
-i mylist.txt Specifies the input file containing the list of videos to merge.
-c copy Short for "codec copy," this tells FFmpeg to copy the video and audio streams directly without re-encoding.
final_video.mp4 The filename for the final, merged output video.

🧠 Method 2: The Concat Filter (Re-encoding)

When to use it: When your video clips have different formats, resolutions, or frame rates.

This method re-encodes all video streams to make them uniform. It offers maximum compatibility but takes significantly more time.

The FFmpeg Command:

ffmpeg -i clip1.mp4 -i clip2.mov -i clip3.webm -filter_complex "[0:v][1:v][2:v]concat=n=3:v=1:a=1[v][a]" -map "[v]" -map "[a]" final_video.mp4

The Breakdown:

Parameter Explanation
-i clip1.mp4 ... List all videos you want to merge as separate input files.
-filter_complex Used to define a complex filtergraph.
"[0:v][1:v][2:v]..." [0:v] refers to the video stream of the first input, [1:v] to the second, and so on.
"...concat=n=3:v=1:a=1..." Calls the concat filter. n=3 specifies there are 3 input segments; v=1 means there will be 1 output video stream; a=1 means 1 output audio stream.
"...[v][a]" Names the final concatenated video and audio streams as [v] and [a] respectively.
-map "[v]" -map "[a]" "Maps" the named video and audio streams to the final output file.

Conclusion: If your clips are all in the same format, always prefer Method 1 for its incredible speed and quality preservation. If your clips are mismatched, Method 2 provides the robust compatibility needed to join them all correctly.