Opened 5 years ago

Last modified 3 years ago

#7909 new defect

Missing frames after encoding

Reported by: aleksid2 Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

ffmpeg.exe -y -i src.mp4 -c:v libx264 -preset slow -b:v 8000k dst.mp4

FFmpeg 4.1.3, Win64, built by Zeranoe.

After re-encoding of my source video file with libx264 and bitrate 8000k mode I see many missing frames (about 300 frames). 

After re-encoding I see only 2 images and 3rd image is missing. I played created video in VLC player 3.0.6, MPC-HC, Media player in Windows 10.

ffplay.exe plays correctly created video.

If I use -crf 22 instead of bitrate mode created video looks correctly in all players.

Source video (src.mp4) for testing: 
https://drive.google.com/open?id=1gK06QtN8IqQNwAZeJdg7lbQgX0tkjaOn

Attachments (1)

src.mp4 (2.2 MB ) - added by aleksid2 5 years ago.

Change History (5)

by aleksid2, 5 years ago

Attachment: src.mp4 added

comment:1 by aleksid2, 5 years ago

Source video shows 3 static images, they advance every 10 seconds, total duration is 28 seconds.
1920 x 1080, 30p.

It seems that libx264 incorrectly encodes such visual content with 1-pass 8000k bitrate mode.

comment:2 by Carl Eugen Hoyos, 5 years ago

Component: ffmpegundetermined
Version: 4.1unspecified

Please test current FFmpeg git head and provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

comment:3 by aleksid2, 5 years ago

Same problem with latest FFmpeg (May 17, 2019) from Zeranoe - ffmpeg-20190517-96c79d4-win64-static.zip

D:\5\latest-ffmpeg>ffmpeg -y -i src.mp4 -c:v libx264 -preset slow -b:v 8000k dst.mp4
ffmpeg version N-93884-g96c79d4e1f Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 28.100 / 56. 28.100
  libavcodec     58. 52.101 / 58. 52.101
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 53.101 /  7. 53.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'src.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:00:28.36, start: 0.000000, bitrate: 995 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 992 kb/s, 29.93 fps, 29.97 tbr, 11988 tbn, 119.88 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 000001c03251c880] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 000001c03251c880] profile Progressive High, level 5.0, 4:2:0, 8-bit
[libx264 @ 000001c03251c880] 264 - core 157 r2970 5493be8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=8000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'dst.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.27.103
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 8000 kb/s, 29.97 fps, 11988 tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.52.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/8000000 buffer size: 0 vbv_delay: -1
frame=  849 fps= 32 q=-1.0 Lsize=    6733kB time=00:00:28.22 bitrate=1953.9kbits/s speed=1.05x
video:6722kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.161421%
[libx264 @ 000001c03251c880] frame I:5     Avg QP: 1.84  size:1170525
[libx264 @ 000001c03251c880] frame P:214   Avg QP: 0.85  size:  3705
[libx264 @ 000001c03251c880] frame B:630   Avg QP: 1.18  size:   376
[libx264 @ 000001c03251c880] consecutive B-frames:  0.9%  0.2%  0.4% 98.5%
[libx264 @ 000001c03251c880] mb I  I16..4: 32.1%  9.3% 58.6%
[libx264 @ 000001c03251c880] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  4.0%  0.0%  0.0%  0.0%  0.0%    skip:96.0%
[libx264 @ 000001c03251c880] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  2.3%  0.0%  0.0%  direct: 0.3%  skip:97.4%  L0:73.2% L1:26.8% BI: 0.0%
[libx264 @ 000001c03251c880] final ratefactor: -9.32
[libx264 @ 000001c03251c880] 8x8 transform intra:9.3% inter:23.1%
[libx264 @ 000001c03251c880] direct mvs  spatial:99.4% temporal:0.6%
[libx264 @ 000001c03251c880] coded y,uvDC,uvAC intra: 84.2% 84.9% 84.5% inter: 0.5% 0.7% 0.7%
[libx264 @ 000001c03251c880] i16 v,h,dc,p: 50%  5% 25% 20%
[libx264 @ 000001c03251c880] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 18% 14%  6%  8%  8% 10%  8% 14%
[libx264 @ 000001c03251c880] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16%  9% 12%  8% 10% 11%  9% 12% 12%
[libx264 @ 000001c03251c880] i8c dc,h,v,p: 69%  9% 10% 12%
[libx264 @ 000001c03251c880] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001c03251c880] ref P L0: 83.1%  0.0%  7.9%  8.6%  0.3%
[libx264 @ 000001c03251c880] ref B L0: 34.4% 65.5%  0.1%  0.0%
[libx264 @ 000001c03251c880] ref B L1: 100.0%  0.0%
[libx264 @ 000001c03251c880] kb/s:1943.65
D:\5\latest-ffmpeg>

comment:4 by Balling, 3 years ago

But if this is a bug in x264, we cannot do anything. Open issue there https://code.videolan.org/videolan/x264/

Note: See TracTickets for help on using tickets.