ffmpeg: Concat MP4 files


For those who want to concatenate MP4 files with the same resolutions. The article is based on answers from Stackoverflow .

Summary

Prepare the list of MP4 files. If you want to cancat video0.mp4 and video1.mp4 then you can make a list like this:

echo "file video0.mp4" > mylist.txt
echo "file video1.mp4" >> mylist.txt

Give the name of the file to the command like this:

 ffmpeg -f concat -i mylist.txt -c copy output.mp4

Then you’ll see them concatenated. HAPPY END.

Detailed explanations

For more detailed explanations, please see other pages. References:

I wrote this since I found what I want was in the second answer of stack overflow, not the first one. How impatient.

How to concatenate two MP4 files using FFmpeg?

According to the page mentioned above, the command becomes more complex when you want to concatenate files with different resolutions. I haven’t tested this, so I’m not sure if it works with MP4 files as well.

ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv \
-filter_complex "[0:v] [0:a] [1:v] [1:a] [2:v] [2:a] \
concat=n=3:v=1:a=1 [v] [a]" \
-map "[v]" -map "[a]" output.mkv

Notes

This page is licensed under CC BY-SA 4.0. (For the citation from Stackoverflow)