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.mp4What each flag does
| -f concat | Tells FFmpeg to use the concat demuxer, which stitches files listed in a text file. |
| -safe 0 | Allows absolute file paths in the list — required unless your paths are relative to the list file's location. |
| -i list.txt | A plain text file with one line per clip: file 'clip1.mp4'. |
| -c copy | Stitches 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.mp4This 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.
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 templatesCommon questions
Do all clips need the same resolution?+
What's the file format for list.txt?+
file 'path/to/clip.mp4' — the word file, a space, then the path in single quotes.Can I merge clips with different frame rates?+
-r 30 (or your target rate) to normalize frame rate across all clips.