Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#8207 closed defect (duplicate)

Invalid MOV file produced when encoding 4K (3840x2160) 10-bit YUV 4:2:2 libx264 stream

Reported by: Jon Frydensbjerg Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

FFmpeg seems to produce an invalid MOV file (pixel format is missing and codec is incorrect) when encoding a 4K (3840x2160) stream using libx264 10-bit and YUV 4:2:2 chroma subsampling.

Other resolutions, other containers (MXF and ISO MP4 are fine at least) and other pixel formats seems to work fine.

The defect is present in both FFmpeg 4.1.3 and 4.2.1 - possibly more versions.

How to reproduce:

% ffmpeg -i test.mp4 -c:v libx264 -pix_fmt yuv422p10le out.mov
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.3)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-librsvg --enable-libtheora --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-libjack --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-indev=jack --enable-opencl --disable-outdev=xv --enable-audiotoolbox --enable-videotoolbox --enable-sdl2 --disable-securetransport --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-x86asm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:01.02, start: 0.000000, bitrate: 5657 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 3840x2160, 5690 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 70 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fa2e0055600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fa2e0055600] profile High 4:2:2, level 5.1, 4:2:2, 10-bit
[libx264 @ 0x7fa2e0055600] 264 - core 157 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 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=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=81 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mov, to 'out.mov':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv422p10le, 3840x2160, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.35.100 aac
frame=   30 fps=6.8 q=-1.0 Lsize=     804kB time=00:00:01.02 bitrate=6430.1kbits/s speed=0.231x    
video:791kB audio:11kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.304305%
[libx264 @ 0x7fa2e0055600] frame I:1     Avg QP:29.59  size:162150
[libx264 @ 0x7fa2e0055600] frame P:8     Avg QP:29.92  size: 44100
[libx264 @ 0x7fa2e0055600] frame B:21    Avg QP:30.96  size: 14008
[libx264 @ 0x7fa2e0055600] consecutive B-frames:  6.7%  0.0%  0.0% 93.3%
[libx264 @ 0x7fa2e0055600] mb I  I16..4: 46.5% 52.5%  1.0%
[libx264 @ 0x7fa2e0055600] mb P  I16..4: 11.5%  9.5%  0.0%  P16..4: 28.6%  2.5%  1.3%  0.0%  0.0%    skip:46.5%
[libx264 @ 0x7fa2e0055600] mb B  I16..4:  0.7%  0.4%  0.0%  B16..8: 18.0%  0.2%  0.0%  direct:11.7%  skip:69.0%  L0:45.3% L1:54.6% BI: 0.1%
[libx264 @ 0x7fa2e0055600] 8x8 transform intra:46.7% inter:96.4%
[libx264 @ 0x7fa2e0055600] coded y,uvDC,uvAC intra: 12.3% 33.0% 7.1% inter: 1.7% 19.3% 0.0%
[libx264 @ 0x7fa2e0055600] i16 v,h,dc,p: 16% 70%  8%  6%
[libx264 @ 0x7fa2e0055600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 25% 42%  2%  5%  3%  5%  1%  4%
[libx264 @ 0x7fa2e0055600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 27%  9%  2% 13% 10% 10%  3%  2%
[libx264 @ 0x7fa2e0055600] i8c dc,h,v,p: 51% 26% 19%  4%
[libx264 @ 0x7fa2e0055600] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fa2e0055600] ref P L0: 64.5% 16.5% 19.0%
[libx264 @ 0x7fa2e0055600] ref B L0: 80.6% 15.5%  3.8%
[libx264 @ 0x7fa2e0055600] ref B L1: 87.5% 12.5%
[libx264 @ 0x7fa2e0055600] kb/s:6472.95
[aac @ 0x7fa2e000da00] Qavg: 783.853

% ffprobe out.mov 
ffprobe version 4.1.3 Copyright (c) 2007-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.3)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-librsvg --enable-libtheora --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-libjack --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-indev=jack --enable-opencl --disable-outdev=xv --enable-audiotoolbox --enable-videotoolbox --enable-sdl2 --disable-securetransport --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-x86asm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[h264 @ 0x7f949201f600] non-existing PPS 0 referenced
[h264 @ 0x7f949201f600] decode_slice_header error
[h264 @ 0x7f949201f600] no frame!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9492001a00] decoding for stream 0 failed
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9492001a00] Could not find codec parameters for stream 0 (Video: h264 (aivx / 0x78766961), none, 3840x2160, 6478 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.20.100
  Duration: 00:00:01.05, start: 0.000000, bitrate: 6294 kb/s
    Stream #0:0(eng): Video: h264 (aivx / 0x78766961), none, 3840x2160, 6478 kb/s, 30 fps, 30 tbr, 15360 tbn, 30720 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.35.100 libx264
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 82 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Attachments (1)

test.mp4 (705.8 KB ) - added by Jon Frydensbjerg 5 years ago.

Download all attachments as: .zip

Change History (4)

by Jon Frydensbjerg, 5 years ago

Attachment: test.mp4 added

comment:1 by Carl Eugen Hoyos, 5 years ago

Resolution: duplicate
Status: newclosed

comment:2 by Jon Frydensbjerg, 5 years ago

Cool, thanks for the work-arond, cehoyos - I had to add -strict -2, as well.

Seems like this is a regression, BTW. I had an older 4.1 build lying around. Encoding worked back then even without adding -vtag avc1 -strict -2. I'm wondering if this is something that should to be addressed?

comment:3 by Jon Frydensbjerg, 5 years ago

Hmm, interesting... -vtag avc1 isn't necessary it seems, but -strict is (BTW, -strict -1 works just as well).

Note: See TracTickets for help on using tickets.