FFmpeg · Command Guide

How to Merge Multiple Video Clips With FFmpeg

Stitching several clips into one file. The fast, lossless method requires the clips to share the same codec and resolution — otherwise you need to re-encode.

Stitching several clips into one file. The fast, lossless method requires the clips to share the same codec and resolution — otherwise you need to re-encode.

The command

ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4

What each flag does

-f concatTells FFmpeg to use the concat demuxer, which stitches files listed in a text file.
-safe 0Allows absolute file paths in the list — required unless your paths are relative to the list file's location.
-i list.txtA plain text file with one line per clip: file 'clip1.mp4'.
-c copyStitches without re-encoding — fast, but only works if all clips share codec, resolution, and frame rate.

Where this goes wrong

If the clips come from different sources — different phones, different export settings — they rarely share identical codec parameters, and stream-copy concatenation will produce a broken or corrupted output with no clear error. The fix is to re-encode instead.

If the clips don't match (re-encoding version)

ffmpeg -f concat -safe 0 -i list.txt -c:v libx264 -crf 20 -c:a aac output.mp4

This decodes and re-encodes every clip to a common format before stitching, which fixes mismatches at the cost of render time and a small quality loss.

After the command

Merging is a pre-processing step. Once your clips are combined into one already-cut video, that's exactly the input NULLFRAME's templates are built to take.

See the templates

Common questions

Do all clips need the same resolution?+
For stream copy, yes. For the re-encoding version, FFmpeg will still fail on mismatched resolutions unless you also scale each input to match — add a scale filter per input in a filter_complex.
What's the file format for list.txt?+
One line per clip, exactly: file 'path/to/clip.mp4' — the word file, a space, then the path in single quotes.
Can I merge clips with different frame rates?+
Not with stream copy. With re-encoding, add -r 30 (or your target rate) to normalize frame rate across all clips.