Combine Multiple Videos Using ffmpeg

As seen on ma.ttias.be. I’m just documenting this in my own way for future reference. This method is only applicable to videos of the same dimensions and encoding. Tested on FFmpeg 4.3. I use this method to download and concatenate youtube-dl outputs.

Step 1: Create a text file and make a list of video files.

touch files.txt
vi files.txt

Example content to save:

file 'p1.mp4'
file 'p2.mp4'
file 'p3.mp4'
file 'p4.mp4'

Step 2: Run the command below

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

Written by MighilMighil is an indie musician and tinkerer with diverse work experience in technology and writing. He has had the privilege of serving in various capacities, encompassing generalist and specialist roles. He is currently based in Chengdu.

Newsletter

Opt-in to receive long-form essays in your inbox. Unsubscribe anytime. Follow me on 𝕏 if you like.

Powered by DigitalOcean, BunnyCDN, WordPress.