Ticket #1678 (closed defect: fixed)
Regression with -vsync 1
|Reported by:||jwjwjw||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
Summary of the bug:
It seems that the latest version of ffmpeg from git has a bug with -vsync 1. I re-encoded some footage from BBC television and the A/V sync slightly drifts over time which is noticeable with the lipsync being off, even though the original file has no sync issues. Using -vsync 1 has always fixed this in the past but it no longer works with the latest version of ffmpeg (N-43888-gfef9e84). It does, however, work with an earlier version, N-31890-gecaf514.
Included is a sample file (bbc1sample.mp4) as well as two ffmpeg output files, bbc1-ok.mov and bbc1-fail.mov, the 'ok' being encoded using N-31890-gecaf514 which is in perfect sync and the 'fail' being from the latest git master (N-43888-gfef9e84) which slowly drifts out of sync (I think it's out by around 0.1s in the sample media because I couldn't upload a larger clip, but as time goes by the sync gets worse and you can notice the lipsync is slightly off when the man is talking in vision). Both used identical ffmpeg options, just different ffmpeg versions.
However, playing the encoded file in QuickTime? is fine. No sync issues. Using VLC or encoding to FLV and playing it in Flash does exhibit the sync issue. The original bbc1sample.mp4 plays fine in all players. Frame by frame visual comparisons between the 'ok' and 'fail' clips show a mismatch.
N-31890-gecaf514 results in a file with a duration of 00:00:49.64 and the latest version produces a file with a duration of 00:00:49.72. The sample outputs were encoded using libx264 and libfaac to reduce the file size but the problem occurs regardless of video or audio codec and the use or omission of -async has no effect either.
I have included log files which should hopefully shed more light on it.
How to reproduce:
% ffmpeg -i bbc1sample.mp4 -vb 300k -vsync 1 -async 1 -acodec libfaac -ab 192k -ac 2 -ar 44100 -vcodec mpeg4 bbc1-fail.mov ffmpeg version N-43888-gfef9e84 Copyright (c) 2000-2012 the FFmpeg developers built on Aug 25 2012 01:37:52 with gcc 4.4.5 (Debian 4.4.5-8) configuration: --enable-libdc1394 --prefix=/usr --extra-cflags='-Wall -g ' --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --extra-libs=-lgcrypt --disable-altivec --disable-armv5te --disable-armv6 --disable-vis libavutil 51. 70.100 / 51. 70.100 libavcodec 54. 54.100 / 54. 54.100 libavformat 54. 25.104 / 54. 25.104 libavdevice 54. 2.100 / 54. 2.100 libavfilter 3. 13.101 / 3. 13.101 libswscale 2. 1.101 / 2. 1.101 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 [h264 @ 0xf81a20] AVC: nal size 21839902 [h264 @ 0xf81a20] no frame! [mov,mp4,m4a,3gp,3g2,mj2 @ 0xf7b240] max_analyze_duration 5000000 reached at 5022161 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbc1sample.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf54.25.104 Duration: 00:00:49.58, start: 0.000000, bitrate: 900 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 798 kb/s, 28.27 fps, 25 tbr, 1k tbn, 50 tbc Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 93 kb/s Metadata: handler_name : SoundHandler -async is forwarded to lavfi similarly to -af aresample=min_comp=0.001:min_hard_comp=0.100000. Output #0, mov, to 'bbc1-fail.mov': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf54.25.104 Stream #0:0(und): Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=2-31, 300 kb/s, 25 tbn, 25 tbc Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 192 kb/s Metadata: handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (h264 -> mpeg4) Stream #0:1 -> #0:1 (aac -> libfaac) Press [q] to stop, [?] for help [h264 @ 0x12a07a0] AVC: nal size 21839902 Last message repeated 1 times [h264 @ 0x12a07a0] no frame! Error while decoding stream #0:0: Operation not permitted frame= 1243 fps=189 q=31.0 Lsize= 3069kB time=00:00:49.57 bitrate= 507.2kbits/s dup=1 drop=159 video:2116kB audio:920kB subtitle:0 global headers:0kB muxing overhead 1.077261%
- Keywords regression added
- Priority changed from normal to important