[FFmpeg-user] Can't get a/v synchronisation right with mpeg transport stream that has gaps in it

Erik Slagter erik at slagter.name
Wed Mar 29 17:44:45 EEST 2017


Hi Carl,

> not what we absolutely need to help you:
> Needs -async 1

Have a look at this part of the command line:

-filter:a " 
aresample=async=10000:min_comp=0.1:min_hard_comp=0.1:max_soft_comp=10000:first_pts=0"

This is what -async 1 does (-async is declared "obsolete").

>> I was under the impression that ffmpeg would automatically base the
>> synchronisation of the (single) audio stream on the (single) video
>> stream. Is this a correct assumption or do I need to specify an explicit
>> "-map" statement?
>
> (After reading parts of your mail)
> Unfortunately, it is not that simple:
> Players can simply drop frames (or increase video playback speed)
> for "missing" audio, this doesn't work with ffmpeg (the application),
> silence has to be created and inserted.

Yeah, fine by me, I don't care.

As far as I understand:

- -vsync vfr just adjusts the timestamps
- -vsync cfr drops/dups frames, which is fine, no need to fiddle with 
the audio stream
- -async 1 (and variants) stretch/shrink audio samples
- asresample stretch/shrink/dup/drop audio samples

All of them are fine by me, although dupping/dropping video frames is 
preferred.

With vsync=1 is do see frame dropping/dupping taking place. The problem 
is that after each "desync" event, gaps in the transport stream that 
have timestamp discontinueties, audio and video get skewed just a little 
bit more, every gap makes them skew another ~100 ms.

So that's why I asked if the explicit "-map 0:v,0:a -map 0:a" (or 
another method) is actially required, to have the video synced to the 
audio (and not the to nominal frame rate, I think that is the actual 
problem).


More information about the ffmpeg-user mailing list