FFmpeg recipe

FFmpeg: Merge / Concatenate Two MP4 Videos

For videos with identical codec / resolution / fps, concat demuxer is lossless and instant. Otherwise use the concat filter to re-encode.

Command

# Step 1: build a list file
echo "file 'clip1.mp4'
file 'clip2.mp4'" > list.txt

# Step 2: concat (lossless)
ffmpeg -f concat -safe 0 -i list.txt -c copy -y output.mp4
Prefer no terminal?
Use the Video Merger in your browser
Open Video Merger

What each flag does

-iInput file. Can be a video, audio, or image. Repeat for multiple inputs.
-c copyStream-copy: no re-encoding. Output is bit-identical between cut points. Fastest possible.
-yOverwrite output file without confirmation.
-f concatUse the concat demuxer (file-list-driven concatenation).
-safe 0Allow absolute paths in the list file.

Notes & gotchas

  • All inputs must share codec, resolution, frame rate, and audio settings for -c copy. Mismatch → garbled output.
  • For mismatched inputs, use the concat filter: -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" with re-encoding.

Related recipes