Combining videos using FFmpeg

FFmpeg lets you mix videos together from different sources based on a zero-indexed map of input files. For the diagram given below, you can do ffmpeg -i input_0.mp4 -i input_1.mp4 -c copy -map 0:v:0 -map 1:a:0 -shortest output.mp4 to take the video from input_0.mp4 and audio from input_1.mp4.

June 30, 2025 · 1 min

Concatenating videos with FFmpeg

FFmpeg has support for concatenating files with no re-encoding # file_list.txt file 'source1.mp4' file 'source2.mp4' $ ffmpeg -f concat -safe 0 -i file_list.txt -c copy output.mp4

June 30, 2025 · 1 min

Copying the timestamp of a file

You can use touch -r old new to copy the timestamp of an older file in a newly created file. Useful for doing bulk re-encodes with FFmpeg that benefit from preserving timestamps.

June 30, 2025 · 1 min