[MPlayer-users] Concatenating AVI files - audio sync problem

Ian Pickworth ian at pickworth.me.uk
Thu Feb 24 19:05:17 CET 2005

I have two AVI files, and I want to concatenate them to make one AVI 
file, however, I cannot get the sound in the second file to be properly 
syncronised in the concatenated version, its always about a second out 
of sync.

Both files are encoded identically (MJPEG), having been created using 
mencoder -ss and -endpos options from an original AVI file (also 
recorded using mencoder).
mencoder -oac copy -ovc copy -ss 186 -o 2.avi 2005-02-13_21-46_CH4.avi

I have tried the following:

cat 1.avi 2.avi | mencoder -noidx -ovc copy -oac copy -o output.avi -

This stops at the end of 1.avi, so no concatenation. (I saw this on 
Google as an example of concatenating AVI files, which implied it should 

cat 1.avi 2.avi >cat.avi
mencoder -noidx -ovc copy -oac copy -o output.avi cat.avi

This gives a concatenated file, but the audio is out of sync by about a 
second from the start of the second part. I also tried -forceidx instead 
of -noidx and that made no difference.

cat 1.avi 2.avi >cat.avi
cat cat.avi | mencoder -noidx -ovc copy -oac copy -o output.avi -

Same result as 1), ie stops at end of 1.avi.

If I play back (using either mplayer or xine) 1.avi and 2.avi 
separately, the sound is in sync for both.

Is there a way of concatenating two AVI files in this way and keeping 
the sound in sync for the second (third etc) parts?


More information about the MPlayer-users mailing list