A/V out of sync with certain input files
|Reported by:||Andreas Trottmann||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
Summary of the bug:
There are certain input files that make ffmpeg behave inconsistently with respect to a/v synchronization.
It appears that it affects certain files created by HandBrake from DVD sources.
How to reproduce:
% ffmpeg -i test.mkv out.wav % ffmpeg -i test.mkv -an out.mpg % ffmpeg -i out.mpg -i out.wav result.mpg
This creates result.mpg with a noticeable desynchronization between audio and video.
% ffmpeg -i test.mkv -ss 5 out.wav % ffmpeg -i test.mkv -ss 5 -an out.mpg % ffmpeg -i out.mpg -i out.wav result.mpg
This creates result.mpg (starting at an offset of five seconds from the original) with correct synchronisation between audio and video.
Then, it gets even more weird:
% ffmpeg -i test.mkv test.mpg
This creates test.mpg that plays back with correct a/v-sync, but if you then take *this* test.mpg as an input to ffmpeg:
% ffmpeg -i test.mpg out.wav % ffmpeg -i test.mpg -an out.mpg % ffmpeg -i out.mpg -i out.wav result.mpg
This creates result.mpg which always has wrong a/v-sync, even if you insert "-ss 5" (or -ss with a different offset).
It affects all versions of ffmpeg that I tried, including the recent version in git.
The file in question is available at https://guardian.werft22.net/public/test.mkv
The A/V sync issue can be best observed at about 70 seconds in, when you see the channel being switched (the push of the button on the TV remote should be at the same time as the "static" noise, and the lips of the guy talking afterwards should match the sound). Unfortunately, I was not able to create a test file where the a/v-sync issue can be observed more quickly.
I have used mplayer and vlc to verify the a/v-sync on the input and output files.