Skip to content

Instantly share code, notes, and snippets.

@magicgoose
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magicgoose/1886326d546d5602f856 to your computer and use it in GitHub Desktop.
Save magicgoose/1886326d546d5602f856 to your computer and use it in GitHub Desktop.
ffmpeg bug report (frame dropping when decoding vfr video)

Input file

https://www.dropbox.com/s/skpaxdvgf8or3g3/original.mp4?dl=0

Output file

https://www.dropbox.com/s/cof04pb40dffxn8/converted.mp4?dl=0

Command used

ffmpeg -i {input} -c:v libx264 -crf 0 {output}

See full log in the next file in this gist.

The problem is that ffmpeg drops frames. This is clearly visible. Also, there are warning messages like Past duration … too large

OTOH, the issue is kind of solved if the output framerate is specified explicitly (for example, -r 60). This is not an universal solution, though, because in general frame rate is not known in advance. Also, ffprobe returns bogus frame rate for this video (3.41 fps) — this is probably the average frame rate.

$ ffmpeg -i {input} -c:v libx264 -crf 0 {output}
ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-libvidstab --enable-libx265 --enable-nonfree --enable-vda
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '{input}':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2015-04-02 20:20:45
Duration: 00:00:13.80, start: 0.000000, bitrate: 458 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1440x2560, 457 kb/s, SAR 1:1 DAR 9:16, 3.41 fps, 90k tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2015-04-02 20:20:45
handler_name : VideoHandle
[libx264 @ 0x7fce6082c800] using SAR=1/1
[libx264 @ 0x7fce6082c800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fce6082c800] profile High 4:4:4 Predictive, level 5.0, 4:2:0 8-bit
[libx264 @ 0x7fce6082c800] 264 - core 144 r2533 c8a773e - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=0 mixed_ref=1 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=3 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, mp4, to '{output}':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
encoder : Lavf56.25.101
Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1440x2560 [SAR 1:1 DAR 9:16], q=-1--1, 3.41 fps, 4230k tbn, 3.41 tbc (default)
Metadata:
creation_time : 2015-04-02 20:20:45
handler_name : VideoHandle
encoder : Lavc56.26.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
Past duration 0.656242 too large
Past duration 0.742180 too large
Past duration 0.999992 too large
frame= 48 fps=0.0 q=-1.0 Lsize= 373kB time=00:00:14.09 bitrate= 216.6kbits/s dup=4 drop=3
video:372kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.265412%
[libx264 @ 0x7fce6082c800] frame I:1 Avg QP: 0.00 size: 31651
[libx264 @ 0x7fce6082c800] frame P:47 Avg QP: 0.00 size: 7412
[libx264 @ 0x7fce6082c800] mb I I16..4: 97.1% 0.0% 2.9%
[libx264 @ 0x7fce6082c800] mb P I16..4: 1.8% 0.0% 0.2% P16..4: 1.1% 0.0% 0.1% 0.0% 0.0% skip:96.7%
[libx264 @ 0x7fce6082c800] 8x8 transform intra:0.0% inter:24.0%
[libx264 @ 0x7fce6082c800] coded y,uvDC,uvAC intra: 8.5% 8.1% 8.0% inter: 0.4% 0.6% 0.6%
[libx264 @ 0x7fce6082c800] i16 v,h,dc,p: 93% 7% 0% 0%
[libx264 @ 0x7fce6082c800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 29% 27% 3% 4% 1% 11% 2% 11%
[libx264 @ 0x7fce6082c800] i8c dc,h,v,p: 90% 7% 3% 0%
[libx264 @ 0x7fce6082c800] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fce6082c800] ref P L0: 68.1% 0.1% 19.8% 12.0%
[libx264 @ 0x7fce6082c800] kb/s:215.68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment