Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have tried to concatenate 2 video files (avi) into one sigle video:

cat input1.avi input2.avi | ffmpeg -f avi -i - -vcodec copy -acodec copy final.avi

.. but this does not concatenate the videos. The duration of the final video is not the sum of the input videos.

How can this be done correctly?

share|improve this question

migrated from stackoverflow.com Jul 20 '11 at 5:39

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Try using mencoder:

$ mencoder -ovc lavc start.avi end.avi -o complete.avi

I know it isn't using ffmpeg, but it definitely works.

Using cat won't likely work with avi files because information is stored in the opening bytes of an avi. Thus cat simply shunts the two binary files together, leaving a broken bit in the middle and incorrect metadata at the start.

share|improve this answer
I tried avidemux but Mencoder was just perfect. –  user98265 Sep 18 '11 at 16:34

This: http://avidemux.sourceforge.net/ might help you. If you want to merge the files, use the ready software, if you want to learn how to do it, use the source.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.