[Libav-user] How to perform drift compensation in MPEG-2 recorder

mattes effemm at mykmk.com
Thu Dec 13 19:03:17 CET 2012


I assume that you notice the drift during playback.
Many player are using different approaches in how to sync
the two streams (AV). You might encounter different results
with different players.

One way is to stuff the continuous audio stream in the audio channel
and then sync in the video frames. Playing back the audio, you have to
take two clocks into account and compensate for it. The clock of the
recorder and the playback host will slightly different.

A simple way on the recorder site is to stuff an additional frame 
or toss one. You could soft 'calibrate' it against the real time clock.
This might ease the AV sync on the playback site. But nevertheless 
playback needs to compensate on its own in similar fashion. 


On Tue, 11 Dec 2012 17:40:44 +0100 Mike Versteeg <mike at mikeversteeg.com> wrote

> Using the famous (and only) output example I developed an MPEG-2
> recorder for audio and video. Both come from different sources with
> their own clock (audio as PCM and video as bitmaps) and as a result
> over time audio will get out of sync due to small differences in the
> two clocks. To compensate I figured to tweak the audio PTS, but it
> appears not to be used (it is marked no pts value).
> 
> What would be the proper way to keep A & V in sync?
> 
> Thanks,
> 
> Mike
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user




More information about the Libav-user mailing list