Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Jul 20 '11 at 5:39

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

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: 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.