[Theora-dev] A/V sync strategies

Ivan Popov pin at medic.chalmers.se
Mon Mar 14 08:47:12 PST 2005

Hello Keenan,

On Sat, Mar 05, 2005 at 08:32:57PM -0500, Keenan Pepper wrote:
> Ivan Popov wrote:
> >but I'd appreciate if you can give a run the theora-encoder script
> >and see if it breaks in the same way (it shouldn't).
> Sorry, but I ran the script using the example_encoder from theora svn 
> and mplayer 1.0pre6, and the sync is off by a quarter of a second after 
> a half hour. I'm fairly sure I have the correct framerate, because I 

oh! I have never seen that.

> used "-f 24000 -F 1001", and the audio is actually lagging behind the 
> video, indicating the frame rate should be lower than 24000/1001 on average.

What happens if you do not use these flags?

> >The script runs mplayer and as such does not make the sync a "Theora
> >issue", the data which theoraenc is fed with should be correct
> >and that's enough.
> So this is a problem with mplayer then? I thought mplayer used feedback 
> from the sound card and video driver to adjust the sync, which obviously 
> cannot work when it's just dumping the raw material to a pipe.

I do not know details about the original data stream.
In a rational world, it should contain a couple of streams, each
timestamped so that each of them can be played correctly alone.
My experience is that it is usually the case.

You wrote:
> MPEG video's frame rate can vary slightly because
> each frame has an associated PTS ("presentation timestamp"), which do
> not form an exact arithmetical sequence.

Even then, the errors should not accumulate, I think.

Your results suggest that the file contains two "badly timestamped"
streams, compensating for that by synchronization information between
the streams, so that one of them is used as timing source for the other -
or that mplayer does not account for the timing information in the MPEG2
stream (which I doubt).

Does mplayer correctly play the original file in the normal mode?
What does it say about the framerate?


More information about the Theora-dev mailing list