[MEncoder-users] A/V offsync; muxing x264, ogg, srt

Scott K Fones boson245 at gmail.com
Mon Jul 24 16:59:48 CEST 2006


I'm trying to back up a dvd using mencoder and mkvmerge to mux a x264
video, vorbis audio and a .srt subtitle.  The result is perfect at the
beginning, but by the end the audio is 900ms late.  

I'm also a complete noob to this stuff.  I've been doing this for about
a week now and everything I have is gleaned from mplayer's documentation
(the subtitle stuff is from bunkus.org).  So, first I'll run down what I
do.  Hopefully there's some obvious problem there, or just a better way
to do things.

My dvd is 24000/1001 fps throughout.

My first pass
mencoder <input> -mc 0 -noskip -vf
pullup,softskip,crop=720:464:0:6,hqdn3d=2:1:2,harddup -ovc x264
-x264encopts
pass=1:turbo=1:bitrate=1500:subq=6:4x4mv:8x8dct:me=3:frameref=5:bframes=3:b_pyramid:weight_b -nosound -ofps 24000/1001 -of rawvideo -o /dev/null

Second pass
mencoder <input> -mc 0 -noskip -vf
pullup,softskip,crop=720:464:0:6,hqdn3d=2:1:2,harddup -ovc x264
-x264encopts
pass=2:bitrate=1500:subq=6:4x4mv:8x8dct:me=3:frameref=5:bframes=3:b_pyramid:weight_b -nosound -ofps 24000/1001 -of rawvideo -o <video>.264

Package it into a mp4
MP4Box -fps 23.976025 -add <video>.264 <video>.mp4

Get the audio
mplayer <input> -vc dummy -vo null -aid <track#> -af volnorm -ao
pcm:file=<audio>.wav

Encode the audio
oggenc -q3 <audio>.wav

Get the subtitles
tccat -i /dev/dvd -T <title#> -L | tcextract -x ps1 -t vob -a 0x2<id#> >
rawsub

Extract images
subtitle2pgm -o <subtitle> -c <filtervalue> < rawsub

Convert subtitles
pgm2txt <subtitle>

Putting it together
mkvmerge -o <file> <video>.mp4 <audio>.ogg <subtitle>.srt

Now, like I said, this works great at the beginning of the video, but by
the end the audio and subtitles are 900ms late w.r.t. video.  The audio
and the subtitles are still sync'd.  I'm not sure where to start
troubleshooting, but I'm guessing it has to do with the video encode.
Any ideas/suggestions?




More information about the MEncoder-users mailing list