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

Alex Cohn alexcohn at netvision.net.il
Wed Dec 19 16:20:43 CET 2012

On Wed, Dec 19, 2012 at 4:34 PM, Mike Versteeg <mike at mikeversteeg.com> wrote:
>> Maybe you should ask which clock is the most precise, and use that one as your master clock? If that's not possible you won't have many other options if everything has to be done on realtime; adapting frame display times as soon as you detect the need will be much easier than modifying sound chunks, I think.

It's not a question of clock precision; video should follow audio
because it's FPS is much lower, and it is more resilient to slight

> Either one can be used as master clock for the recorder. But I cannot sync both clocks with each other if that's what you mean.

Yes you can! You should set the PTS for the video stream according to
the audio clock, that's it. I believe that you can know the audio
clock by counting the audio packets.


More information about the Libav-user mailing list