[MPlayer-users] A/V sync problem when appending AVIs

Daniele Forghieri guru at digitalfantasy.it
Fri Feb 6 09:18:22 CET 2004


Matthias Czapla wrote:

>Hello!
>
>I have created three AVI files with (for each one)
>
>mencoder -aid 128 -srate 44100 -oac mp3lame -lameopts cbr:br=112:aq=2 \
>-ovc frameno -o frameno.avi -dvd-device some_image.bin dvd://1
>for i in 1 2; do
>	mencoder -oac copy -ovc lavc \
>        -lavcopts vcodec=mpeg4:mbd=2:trell:vbitrate=509:vpass=$i \
>	-sws 2 -vf crop=672:316:24:130,scale=544:240 \
>	-dvd-device some_image.bin dvd://1
>done
>
>Each one plays fine as usual, but when appending them via
>
>cat 1.avi 2.avi 3.avi | mencoder -noidx -oac copy -ovc copy -o bla.avi -
>
>I get A/V desyncronized after the point where the second file starts. Before
>that point theres no problem. I already tried to append them with avidemux
>but this produced exactly the same result (i.e. A/V desync). I have often
>done this before without any problems but this time it strikes me.
>
>Regards
>Matthias
>
>_______________________________________________
>MPlayer-users mailing list
>MPlayer-users at mplayerhq.hu
>http://mplayerhq.hu/mailman/listinfo/mplayer-users
>
>  
>
mp3 uses packet of sound of, say, 250 millisec.

In any file you have a certain number of complete packet.

If the length of the video file is not exactly a multiple of the packet 
size (in millisec) you' ve got an A/V desync in the second (and 
successive) files.

At the end of the mencoder encode you got something like
    video: 120.040 sec,  2401 frames
    audio: 120.250 sec

and the sound 'drift' is 210 millisec.

To avoid the problem I encode the audio in PCM and, after you cat the 
files, convert in mp3

    Daniele Forghieri




More information about the MPlayer-users mailing list