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

David Kuehling dvdkhlng at gmx.de
Wed May 10 06:29:32 PDT 2006

>>>>> "Nicholas" == Nicholas Vinen <hb at x256.org> writes:

> 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.

Don't encode to raw YUV, you will lose sync information.  Instead try to
encode to an AVI file with uncompressed video _and_ audio.  Mencoder
will drop/duplicate frames to keep A/V sync when encoding AVI files.

When you're finished, just transcode the AVI to Theora using YUV and PCM
pipes and the example encoder.  This should now work, since the AVI file
has a guaranteed constant frame rate (which the source MPEG file didn't

I transcoded that way and didn't encounter any problems so far.  To
generate the intermediate AVI file, use something like

        mencoder -ac pcm -vc lavc -lavcopts vcodec=ffvhuff:vstrict=-2 ...

hope that helps,

GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40

More information about the Theora mailing list