How to merge many mp4 videos with FFMPEG in a few seconds

I got a video, splitted into lots of files, each only 5 minutes long. I had only two options: either I wasted 30 minutes manually inserting them into a windowed program, or I wasted 2 hours figuring out a command line solution.

Obviously I chose the second option, so in the future the conversion will be more immediate, just follow this post 😉

First of all you have to create a text file that contains the list of files to convert.We have the computer do it. Assuming that all the files to be merged are all located in the same directory and are *.mp4 files, you have to type:

find *.mp4 | sed 's:\ :\ :g'| sed 's/^/file /' > list.txt

This creates a text file called list.txt which contains the file name (preceded by the keyword file).

Then, you pass the list of files to join to FFMPEG, with the command:

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

Done!

Like our content? Sign up to our newsletter to keep in touch.
We'll never send spam, your data will be treated according to our privacy policy

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.