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

Alex Cohn alexcohn at netvision.net.il
Tue Dec 18 13:32:05 CET 2012


On Mon, Dec 17, 2012 at 10:59 AM, Dolevo Jay <cmst at live.com> wrote:
> I capture the video frame by frame from the desktop screen and send them
> over network after encoding. This happens on the PC processor and I have no
> problem with this. It works perfect for now. However, I capture the audio
> separately with the help of an HID device which has its own processor. I can
> send the audio even without encoding but still the problem is the video and
> audio get out of sync and drift occurs although I sync the processors at the
> very beginning. Could anyone shed any light on this issue?

You can set the video PTS in sync with the current audio "clock". Most
likely, your audio packets arrive at fixed nominal frequency which is
not precise (from the point of view of your PC clock). In this case
you should calculate PTS by multiplying the expected audio packet
duration by number of actual audio packets received.

BR,
Alex


More information about the Libav-user mailing list