[Theora] A/V sync. problems with NTSC DVD source

Nicholas Vinen hb at x256.org
Tue Apr 4 17:09:51 PDT 2006


Hi,

I decided to try Theora and encoded a PAL DVD. I was very pleased with 
the result. It's better than "DiVX" for the same bitrate, I think, and 
the audio is clearly superior to MP3 audio.

However, I'm having serious troubles encoding NTSC DVDs and getting the 
video and audio durations to match.

I read some messages on this list about such problems and so what I am 
doing is:

* Using mencoder to encode the DVD to a raw YUV file, with pulldown, and 
PCM audio. I've set the output frame rate to 23.976, which I believe is 
correct for an inverse-telecined NTSC movie.
* Using mplayer to play the YUV file into a raw YUV FIFO, as required by 
the theora encoder. Using another instance of mplayer to play the PCM 
audio into a WAV FIFO.
* Running the example encoder on the two FIFOs.

This is roughly the procedure which works well with PAL DVDs, except 
minus the telecine/pulldown stuff. However, I find that the audio is out 
by about one second per minue of video. The further into the video I 
play back, the more the audio gets ahead of the video. This indicates 
the detected frame rate, 23.976, is too low. If I force the 
example_encoder to use a frame rate near 24.34 (without adjusting any of 
its inputs), it's much closer to being correct. However it's almost 
impossible to get it exactly right. By the end of the movie there will 
always be a delay unless I go through a ridiculously long period of 
trial and error.

Several of the DVDs I have tried seem to have random frame rate changes 
between 23.976 and 29.98 in them. My understanding is using the "ofs" 
flag in mencoder will smooth it out to give the proper 23.976 average. 
Perhaps this is not working, hence my problems?

Anyway I would love to hear from anyone who has successfully encoded 
this type of video in theora and how they did it without the A/V sync. 
problems.

I may share the perl script I wrote, if I get it working in all cases, 
which makes encoding DVD video to Theora easy.


Nicholas


P.S. In case anybody is wondering, I'm encoding the DVDs so I can watch 
them off my hard drive without having to go fetch the disc etc. I find 
it more convenient that way.



More information about the Theora mailing list