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

Erik Slagter erik at slagter.name
Fri Mar 31 10:50:34 EEST 2017


On 30-03-17 01:01, Carl Eugen Hoyos wrote:
> 2017-03-29 16:44 GMT+02:00 Erik Slagter <erik at slagter.name>:
>
>>> 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").
>
> At least I find "-async 1" easier to remember so I hope it will stay...
>
> Please provide a sample if it doesn't work for you.

The "sample" is 1.5 hours long, with the gaps spread over the complete 
running time.

It's quite easy to create one yourself though.

- create an mpeg transport stream with h264 video and ac3 audio (even 
better if you can have one completely from a DVB source)
- at multiple locations, cut out a piece, doesn't really matter how far 
spread out or how long the gaps are; use a file-level cutter, like dd, 
it's important that the gaps have incomplete packets (so don't use a 
tool that is aware of mpeg stream structure, like ffmpeg itself)

That's all. Now convert it to something else, using ffmpeg, like 
mjpeg+pcm in mkv, using the flags mentioned. You'll that most of the a/v 
desync created by the gap is worked around by ffmpeg, but a tiny bit is 
left, making the audio and video get out of sync just a little bit more 
with every gap, 100-200 ms.


More information about the ffmpeg-user mailing list