Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
9th February 2007, 04:29 | #1 | Link |
Registered User
Join Date: Jan 2007
Location: Chicago, Ill., USA
Posts: 7
|
mencoder, x264, vorbis, matroska - bad a/v sync problems
Hello!
I using a procedure similar to the one described here to rip DVDs (the ones I own of course) to my hard drive. I'm having pretty bad A/V sync problems, particularly with TV episodes. So far I've experimented with the H264+Vorbis in the Matroska container with Batman Begins (the movie) and episodes of House, MD season 2. With Batman Begins, the A/V was almost perfectly in sync, possibly so little that I can live with it. House on the other hand is awful---the A/V sync is unbearable. Based on the research I've done, I've been able to find the following suggestions, all of which I've tried, but have not helped:
Of course, if I play these episodes directly from the DVD with mplayer, the audio and video is perfectly sync'ed. I know there's ways to manually tweak the sync while muxing, but I'd really like this fully automated, as I intend to batch process all my DVDs with a script. I would greatly appreciate any suggestions or ideas. Thanks! Matt |
9th February 2007, 05:42 | #2 | Link | |
Registered User
Join Date: Jul 2006
Posts: 276
|
Quote:
don't use softskip, pullup, or noskip. just use -ofps with whatever output frame rate you want (e.g. 24000/1001). you can use harddup if you're increasing the fps, but I would recommend leaving it out and going with an equal or lower fps. also, do a dummy audio transcode along with the video. using "-oac lavc -lavcopts acodec=mp2:abitrate=224" should be fast enough not to slow things down too badly. output to -of avi instead of rawvideo then just leave out the mp2 audio when you remux everything into mkv. hope this helps. -Justin |
|
9th February 2007, 06:08 | #3 | Link | |
Registered User
Join Date: Jan 2007
Location: Chicago, Ill., USA
Posts: 7
|
Quote:
Thank you for the suggestions... I'm slowly trying to learn the ins-and-outs of all this. Thanks again, Matt |
|
10th February 2007, 06:13 | #4 | Link | |
Registered User
Join Date: Jul 2006
Posts: 276
|
Quote:
The frame rate changing throughout the stream is one thing that could be causing your problems. Those frame rate changes don't make it into the raw video. Setting a fixed output frame rate using -ofps will skip any necessary frames...if you encode it along with audio. As far as avi, it's arbitrary. You need to remux into a container since you'll have that dummy audio stream. mpeg would work too, but avi is less complex. You should be able to feed the video only from your avi into the matroska muxer...then discard it just like you would the raw video. edit: If you're worried about the 2GB file size limit, you'll probably have to do more complex things... -Justin Last edited by jruggle; 10th February 2007 at 06:24. |
|
12th February 2007, 01:29 | #5 | Link | |
Registered User
Join Date: Jan 2007
Location: Chicago, Ill., USA
Posts: 7
|
Quote:
So close! Thanks again, Matt |
|
12th February 2007, 14:45 | #7 | Link | |
Registered User
Join Date: Jan 2007
Location: Chicago, Ill., USA
Posts: 7
|
Quote:
I accidentally specified lavc as the video codec. I wondered why, in addition to what I posted above, the quality looked so bad and the encoding went so fast. I'll try again and report back! Matt |
|
12th February 2007, 23:19 | #8 | Link | |
Registered User
Join Date: Jan 2007
Location: Chicago, Ill., USA
Posts: 7
|
Quote:
As for which is more portable, 2+ GB AVI files or Matroska files w/h.264 and Vorbis audio... well... the latter at least wins in correctness, (IMO) coolness, and portability---at least in the theoretical sense. Based on my (admittedly limited) research, h264 + vorbis are the two best codecs when quality and filesize are the two biggest factors. Thanks again for all the assistance, Matt |
|
13th February 2007, 15:02 | #9 | Link |
Registered User
Join Date: Jan 2007
Location: Chicago, Ill., USA
Posts: 7
|
Still no luck
I had high hopes too: I've been running the encodes remotely, from work, and test them at night when I get home. Yesterday, I used midentify to check the length of the Ogg-Vorbis and H264 files: they were only different by about 0.10 seconds. However, I got home and started watching. I was getting really excited, because for the first 10 minutes or so, everything was perfectly sync'ed. Then, almost totally abruptly, the AV got out of sync by about 0.5--1.0 sec (my guess). Any more ideas? Here's the command I used: Code:
mencoder dvd://1 -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=2:bframes=4:b_pyramid:weight_b -idx -ofps 24000/1001 -of avi -vf pullup,softskip,pp=ac,hqdn3d=2:1:2,harddup -o file.avi Regards, Matt |
14th February 2007, 06:47 | #10 | Link | |
Registered User
Join Date: Jul 2006
Posts: 276
|
Quote:
|
|
28th February 2007, 03:18 | #11 | Link |
Registered User
Join Date: Apr 2006
Posts: 99
|
I am having a similar issue with mencoder encoding HDTV to h.264. It's driving me insane.
It is probably stupid that you try what hasn't worked for me, but try it anyway, read the last post of my thread http://forum.doom9.org/showthread.php?t=122082&page=2 and if one of those things works for you, all the better. I'm close to thinking there is no solution to this problem. I've googled, experimented, and ran test encodes for hours to no avail. The worst part is, as you said, it'll appear halfway through the episode. A ten minute clip is useless. It takes time to encode x264, even with settings that make the video look like crap it's realtime on the linux machine I am using. The desktop is faster, but the desktop uses megui and thus doesn't have all of the trivial issues I associate with using linux. |
28th February 2007, 04:17 | #12 | Link | |
Registered User
Join Date: Jul 2006
Posts: 276
|
Quote:
|
|
2nd March 2007, 15:21 | #15 | Link | |
Registered User
Join Date: Jan 2007
Location: Chicago, Ill., USA
Posts: 7
|
Quote:
I'm still stuck. My latest finding is that some of my source material (i.e. the DVD) seems to have A/V sync problems. Someone on the mailing list suggested that, actually, it's probably a problem with mplayer's synchronizing functionality. I'm taking a break from this for now... kind of waiting for someone else to have a breakthrough Matt |
|
2nd March 2007, 23:20 | #16 | Link |
Registered User
Join Date: Mar 2005
Location: Finland
Posts: 2,641
|
The sync problem you're having with AVC in AVI output is due to the hacks needed to store the stream (and especially b-frames). See the discussion on why VFW is bad for H.264 in the MPEG-4 AVC forum if you are interested in details. The sync difference is constant within a file, so if you find out how much it is, it can be compensated when remuxing the stream to a MP4 or Matroska file. Avi2raw or the new mkvmerge might do this automatically, but I haven't tried them.
|
|
|