[FFmpeg-trac] #9573(avcodec:new): mkv color range may be a problem for later

FFmpeg trac at avcodec.org
Fri Dec 31 13:16:48 EET 2021


#9573: mkv color range may be a problem for later
-------------------------------------+-------------------------------------
             Reporter:  Diederick    |                    Owner:  (none)
  Niehorster                         |
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:  avcodec
              Version:  git-master   |               Resolution:
             Keywords:  libx264      |               Blocked By:
  gray10                             |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by Diederick Niehorster):

 Thanks! Seems you do not have to set a profile, the right one is
 automatically selected:
 {{{
 ffmpeg -y -i test.mkv -c:v libx264 -preset veryfast -qp 0 test3.mp4
 }}}
 results in:
 {{{
 [libx264 @ 0000021d6b51fdc0] using cpu capabilities: MMX2 SSE2Fast SSSE3
 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 0000021d6b51fdc0] profile High 4:4:4 Predictive, level 5.1,
 4:0:0, 10-bit
 [libx264 @ 0000021d6b51fdc0] 264 - core 164 r3079 d9a19f0 - H.264/MPEG-4
 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html -
 options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2
 psy=0 mixed_ref=0 me_range=16 chroma_me=0 trellis=0 8x8dct=1 cqm=0
 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=12
 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0
 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=250
 keyint_min=25 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
 Output #0, mp4, to 'test3.mp4':
   Metadata:
     encoder         : Lavf59.10.100
   Stream #0:0: Video: h264 (avc1 / 0x31637661), gray10le(pc, progressive),
 1152x390, q=2-31, 500 fps, 16k tbn (default)
     Metadata:
       DURATION        : 00:00:00.018000000
       encoder         : Lavc59.15.101 libx264
 }}}
 note that profile High 4:4:4 Predictive, level 5.1, 4:0:0, 10-bit is
 selected automatically.

 Anyway, its clear now that this is not in libx264, or on the encoding
 side, at all. It also has nothing to do with mkv (problem shows itself in
 mp4 also). Nor is it even in the decoding side, i have confirmed that the
 h264 decoder correctly delivers AVFrames with color_range=2 (2 is JPEG/pc)
 set on them (and also on the decoder context). The problem is with the
 auto-inserted scale filter used for format conversion (yuv420p10->gray10,
 used since data is stored in yuv420p10 in the file) that does not honor
 the input color_range, unless told what it is with scale=in_range=pc
 (selecting gray10 as output automatically sets out_range to pc, no need to
 specify that in the command). I'm not sure if thats a bug or something
 that can be requested as an enhancement. I'll check out the ticket you
 linked to, and add to that or post a new one.

 It interesting that
 ffmpeg.exe -y -i test.mkv -vf extractplanes=y -frames:v 1 nhcvbqaw.png
 produces garbage. The data in there is after all gray10, and thus in a
 sense only contains a y plane. Extracting a y plane when there only is a y
 plane is perhaps a bit non-sensical, but probably should work. I'll file a
 ticket.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9573#comment:15>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list