[FFmpeg-devel] libavdevice: PTS stability and risks of drift

Olivier Guilyardi list
Mon Feb 2 19:02:30 CET 2009


Luca Abeni wrote:

> I guess you cannot synchronise dv1394 video with OSS audio. But a DV stream
> coming from firewire contains both audio and video, so you should not need such
> a synchronisation.

This is untrue. We are actually working on a university broadcasting
installation, where the video will come from a DV device, and the audio from
other devices. I believe that many professionals are likely to use high quality
audio hardware, such as RME, and not the DV audio input.

> Yes, I suspect you can have a drift between the DV timestamps and system time,
> but such drift can be compensated at the application level (something similar
> to ffmpeg's vsync and async).

If I understand correctly, you recommend that each of libavdevice's demuxers
compute the PTS out of the specific hardware device clock it handles, which will
result in inevitable drifts.

For your information, we have measured the drift between the audio and system
time using 5 different audio sound cards, and obtained linear drifts ranging
from -3ms to +4ms / minutes. That means about 200ms after one hour of recording.

And these are extremely varying, so that I can't think of anything more
difficult than figuring out the right value for -async or -vsync.

To my understanding, one of the roles of libavdevice is to provide demuxers that
play well *together*. If each demuxer uses its own clock, then this task is not
fulfilled IMO.

The solution is to use a single clock that both the audio and video demuxers
have access to: the system clock. This does cause jitters but they can be
reduced by using a Delay Locked Loop filter:

http://www.kokkinizita.net/papers/usingdll.pdf
http://lalists.stanford.edu/lad/2009/01/0095.html

--
  Olivier





More information about the ffmpeg-devel mailing list