[Libav-user] How to perform drift compensation in MPEG-2 recorder
"René J.V. Bertin"
rjvbertin at gmail.com
Tue Dec 18 13:44:49 CET 2012
On Dec 18, 2012, at 13:32, Alex Cohn wrote:
> 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.
Even if a nominal fixed frequency were precise enough with respect to the video frequency it seems you're probably looking at transport delays that are neither constant nor identical (enough) for the two streams. It's not clear if you send video and audio over the same network stream if you maybe even capture the audio on a separate host (possibly the remote)? How big is the drift, I suppose we're not talking about a 1 or 2 frames jitter?
More information about the Libav-user