[MEncoder-users] mencoder concatenation warps audio out of sync

mencoder at perlmeister.com mencoder at perlmeister.com
Wed Nov 4 16:54:42 CET 2009


I have two videos, title.avi and soundtest.avi, which I'd like to
concatenate using mencoder. However, the audio gets out of sync with the
video in the process, and this happens both by copying or recoding it.
I'd be happy for any advice you can give.

You can two small test videos (<1M in size) at

     http://perlmeister.com/tmp/soundtest.avi
     http://perlmeister.com/tmp/title.avi

to verify what I'm seeing below. Playing soundtest.avi, you can see that
audio and video are perfectly in sync. Both videos have the same
video/audio properties:

  title.avi:
  VIDEO:  [MJPG]  160x120  24bpp  30.000 fps  349.9 kbps (42.7 kbyte/s)
  AUDIO: 8000 Hz, 1 ch, u8, 64.0 kbit/100.00% (ratio: 8000->8000)

  soundtest.avi:
  VIDEO:  [MJPG]  160x120  24bpp  30.000 fps  1187.5 kbps (145.0 kbyte/s)
  AUDIO: 8000 Hz, 1 ch, u8, 64.0 kbit/100.00% (ratio: 8000->8000)

Only difference is the bitrate, as title.avi was created by lumping
together a bunch of jpegs and soundtest.avi was taken with a video
camera.

When concatenating the two videos via

     mencoder title.avi soundtest.avi -oac copy -ovc copy -o concat.avi

you get the result available at

     http://perlmeister.com/tmp/concat.avi

for your convenience, and you'll notice that the first audio click is
out of sync with the video and comes about .5 seconds too late. On the
following clicks, however, the audio recovers and gets back in sync with
the video.

It gets worse if the audio of both tracks is re-coded as mp3 via

      mencoder title.avi soundtest.avi -oac mp3lame \
               -ovc copy -o concatmp3.avi

(only visible with a longer video posted at

     http://perlmeister.com/tmp/concatmp3.avi

with is 44M in length), because audio falls back more and more over
time.

Any chance to better sync audio and video with mencoder? Thanks for any
help.

-- Mike

Mike Schilli


More information about the MEncoder-users mailing list