[vlc-devel] dynamically syncing live video and audio
Rémi Denis-Courmont
remi at remlab.net
Mon Jul 4 09:26:56 CEST 2011
On Mon, 4 Jul 2011 09:20:39 +0200, "Feurstein, Michael"
<Michael.Feurstein at wu.ac.at> wrote:
> At the moment I'm measuring the time it takes ffmpeg to open the video
> stream in order to determine the correct value to use with VLC for
> -audio-desync. This works but seems unreliable based on the underlying
> running system.
>
> Is there a way to read out the first presentation time stamps (pts) for
> video and audio in order to resync them? I've been trying to analyze the
> verbose (-vvv) output for VLC but couldn't pin point the exact start of
the
> video. My idea would be to try to calculate the out of syncness based on
> the pts or the actual start of each stream.
On the input side, VLC uses different algorithms for computing the PTS
depending on the format. For those few file formats like MPEG-TS that carry
built-in timestamps, it uses that. For the other (most) file formats, it
just starts from 0 or 1 and extrapolates based on the frame rate or the
audio sample rate. And for live capture, the OS monotonic clock is used as
PTS source.
On the output side, the VLC clock synchronization code will have converted
the PTS from whatever format to the OS monotonic clock.
> If I need to change something in the source could someone tell me where
> the pts is read/calculated so I could just output it? If you guys have
any
> other ideas on how I could accomplish this I'd be happy to hear about
them.
This is input-specific. Depending on the plugin, it should be either in
modules/access/* or modules/demux/*.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list