[Theora] Video and audio not in sync

Sal Valente svalente at mit.edu
Sat Apr 30 17:50:37 PDT 2005

I wrote:

> ffmpeg2theora free.mpeg -x 320 -y 240 -o free.ogg
> The video looked great.  And the audio sounded great.  But they didn't
> look and sound great together.  The video was slightly faster than the
> audio, so that 10 minutes into the show, the people's mouths were
> moving a full second before the line was played, which makes the show
> entirely unwatchable.

The problem is that the mpeg does not use a consistant frame rate.  When
I play the mpeg in mplayer, it logs:

Starting playback...
VO: [xv] 480x480 => 640x480 Planar YV12
A: 160.5 V: 160.5 A-V: -0.011 ct:  0.152 4812/4802  5%  0%  0.7% 0 0
demux_mpg: 24fps progressive NTSC content detected, switching framerate.
A: 161.1 V: 161.0 A-V:  0.047 ct:  0.190 4827/4816  5%  0%  0.7% 0 0
demux_mpg: 30fps NTSC content detected, switching framerate.
Warning! FPS changed 23.976 -> 29.970  (-5.994000) [4]  0%  0.7% 0 0
A: 203.0 V: 202.9 A-V:  0.001 ct:  0.250 6084/6053  5%  0%  0.7% 0 0
demux_mpg: 30fps NTSC content detected, switching framerate.
... etc

Of course, the ogg loses sync at 160 seconds, and it gets worse at 203
seconds, and so on.  So the trick, I assume, is to encode the mpeg using
an encoder that doesn't always write one output frame per one input
frame, but instead always generates 24 output frames per one minute of
input frames, calculated on-the-fly.  The following programs do not do

mplayer -vo yuv4mpeg

It appears that mencoder does what I need, but unfortunately, mencoder
doesn't encode to any interesting codecs.  I suspect that "mencoder -ovc
lavc -lavcopts vcodec=threora" would work, but first someone needs to
make libavcodec support encoding to theora.  Volunteers?  :-)

I'd still appreciate any other advice.  Thanks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/theora/attachments/20050430/9debaba3/attachment.htm

More information about the Theora mailing list