[MPlayer-users] mencoder, x264, vorbis, matroska - bad a/v sync problems

matthew.garman at gmail.com matthew.garman at gmail.com
Tue Feb 13 23:01:08 CET 2007


On Tue, Feb 13, 2007 at 01:11:34PM -0800, RC wrote:
> I can't speak for anyone else, but I'm definately not inclined to
> read through a lengthy how-to and a fourm thread just to figure
> out what command line you are using, and other similar info you
> didn't bother to include in your e-mail.

Good point :)  (In my denfense, I get so wrapped up in things that I
forget not everyone is obsessing over this to the same degree I am!)

Anyway, here's a fairly detailed run down of what I've done thus far:

# audio:
mplayer dvd://1 -ao pcm:fast:file=audio.wav -vc dummy -aid 128 -vo null
normalize audio.wav
oggenc -q7 audio.wav # note: output=audio.ogg

# video:
mencoder -v -alang en -aid 128 -oac lavc -lavcopts acodec=mp2:abitrate=224 \
    -ovc x264 -x264encopts bitrate=2000:partitions=all:8x8dct:me=umh:subq=6:frameref=5:threads=auto:pass=1:turbo=1:bframes=4:b_pyramid:weight_b \
    -idx -ofps 24000/1001 -of avi \
    -vf pullup,softskip,pp=ac,hqdn3d=2:1:2,harddup \
    -o /dev/null dvd://1
# that's pass 1; pass two is the same, except for "pass=2", removal
# of "turbo=1", and output to an actual file (-o video.avi)

# mux
avi2raw video.avi video.h264
MP4Box -fps 23.97602 -add video.h264 video.mp4
mkvmerge -o title.mkv --noaudio video.mp4 audio.ogg

The resulting "title.mkv" as audio/video sync problems.  Questions
are: what did I do wrong (or neglect to do) and what can I try/do
differently?

Variations on what I've tried include the following:
    - Using -nosound instead ov -oac lavc
    - Using -oac copy (instead of lavc or nosound)
    - Adding -mc 0 and -noskip to the mencoder commandline
    - Using -of rawvideo (instead of -of avi), and skipping the
      "avi2raw" step

My most recent trial has been using what I posted above (i.e. not
the variations).  The resulting mkv was perfectly in sync for the
first 10 minutes or so, then got off by maybe 0.5--1.0 seconds.  I
didn't have time to check, but I'm guessing that the audio becomes
unsynchronized at the same time where the source material changes
frame rates.

This is all on gentoo linux on an Athlon 64 X2.  Software versions
are:
    kernel: 2.6.19-gentoo-r2
    MPlayer 1.0rc1-4.1.1
    x264 0.54.x
    MP4Box - GPAC version 0.4.2
    OggEnc v1.0.2
    avi2raw - mpeg4ip version 1.4.1
    normalize 0.7.6
    mkvmerge v1.8.1 ('Little By Little')

> And for your incredibly vague non-question, I can only say I've
> used vorbis audio dozens of times, with no sync problems at all
> (though I use ogm, not mkv).  That's not even counting other
> seperate A/V encoding like externally MP2 audio and PCM, or muxing
> into MPEG, AVI, etc.  Mixed-mode telecine really doesn't cause any
> problem, and there's little reason it should.

I'm jealous.  Any chance you've tried to rip "House, MD", Season 2
episodes from DVD?  Am I doing anything vastly different that you?

Thank you,
Matt




More information about the MPlayer-users mailing list