[FFmpeg-user] Audio synchronisation issues

Dainius (GreatEmerald) pastas4 at gmail.com
Fri May 4 22:48:37 CEST 2012

> (Why, this should work exactly as well with a muxed file, don't you agree?
> And at least in theory, this may have higher chances of being in sync.)

I'm using SoX to modify the audio on a per-stream basis (I don't want
to remove noise from the track that has no noise, after all), and I'm
not aware of it being able to modify a particular stream within a
video file (plus it would have to be remuxed so that there is only one
video and one audio stream for it to be played correctly). That said,
I could record everything into one file and then use ffmpeg with copy
to extract the separate streams after that.

I did some further testing, and it's somewhat confusing. I did get the
audio and video synced correctly, but only if recording only two
streams, not all three. I noticed that it gets desynced when I get
dropped frames (or duplicate frames, which appear as dropped frames in
the video regardless). I get these dropped frames when I record all
three streams, but not when recording only two. Also, putting the
video recording to the last position makes less duplicate frames and
more dropped frames reported, for some odd reason. It also doesn't
seem to matter whether the streams are output to a single file or
multiple files (as async doesn't seem to do much, anyway, at least
when I don't specifically specify what to sync to via maps). And
apparently when the two audio streams come from the same sound card,
the framerate improves (although I don't get why it drops in the first

The really puzzling part of this is that if I add around 1 second of
blank frames into the recording with 3 streams, everything seems to
get synced properly again. That said, I haven't tested long
recordings, so I'm not certain if it doesn't get desynced again after
a while... I'll have to do further tests, it seems.

>>   Duration: N/A, start: 1336135787.509094, bitrate: 460800 kb/s
>>   Duration: N/A, start: 0.649226, bitrate: N/A
> The start times are similar on my system, and I get A/V sync with
> -async 1, but I suspect it is not possible with one device wall clock
> and one device starting with 0.
> (But I may of course be wrong!)

Hmm, true, that does look kind of odd. I wonder what causes that kind
of a discrepancy.

More information about the ffmpeg-user mailing list