ffmpeg: Combine/merge multiple mp4 videos not working, output only contains the first video

Assuming you want to concatenate the movie, you can use the following command:

ffmpeg -f concat -i inputs.txt -vcodec copy -acodec copy Mux1.mp4

With the following text in inputs.txt:

file 75_540_38HQ2.mp4 
file 76_70_20.mp4 
file 76_173_80.mp4
file 81_186_35.mp4

Note: some distributions (like Ubuntu) do not have ffmpeg in their repository and instead define ffmpeg to be an alias of avconv. This won't work with avconv, so in such a case you have to compile ffmpeg yourself. You can check whether you have the real ffmpeg by running ffmpeg and checking if the first output line ends with "the FFmpeg developers".


Forget about FFmpeg, use MP4Box instead, it is easy and faster:

    mp4box -add video1.mp4 -cat video2.mp4 -cat video3.mp4 output.mp4

It is available for Windows, Linux and OS X: http://www.videohelp.com/tools/mp4box

If you are on Windows you can use YAMB which is a GUI for MP4Box that works great: http://www.videohelp.com/tools/YAMB

UPDATE Jun-2016: FFmpeg has added a concatenation filter, more info here: https://stackoverflow.com/a/11175851/218418


From the ffmpeg man page "Examples" section:

You can put many streams of the same type in the output:

ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy \
       -vcodec copy -acodec copy test12.avi -newvideo -newaudio

In addition to the first video and audio streams, the resulting output file test12.avi will contain the second video and the second audio stream found in the input streams list.

The "-newvideo", "-newaudio" and "-newsubtitle" options have to be specified immediately after the name of the output file to which you want to add them.

If you meant you want to concatenate them, the FAQ has instructions.

I'm not sure if this question/answer belongs on SuperUser.

Tags:

Ffmpeg