[FFmpeg-trac] #9573(avcodec:new): libx264 ignores color range flag for gray10 input

FFmpeg trac at avcodec.org
Wed Dec 29 02:21:17 EET 2021


#9573: libx264 ignores color range flag for gray10 input
-------------------------------------+-------------------------------------
             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 pdr0):

 Replying to [comment:2 Diederick Niehorster]:
 > Since ffprobe identifies the encoded pixel format as yuv420p10le, i
 decided to see if things do look fine if that the input i provide to the
 encoder. Command:
 > {{{
 > ffmpeg -y -i test.mkv -vf "format=yuv420p10" -c:v libx264 -preset
 veryfast -crf 0 test.mp4
 > }}}
 > Then things perceptually look fine (but see below), despite the color
 range flag apparently being lost, according to ffmpeg output:
 > {{{
 > Output #0, mp4, to 'test.mp4':
 >   Metadata:
 >     encoder         : Lavf59.10.100
 >   Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p10le(tv,
 progressive), 1152x390, q=2-31, 500 fps, 16k tbn (default)
 >     Metadata:
 >       DURATION        : 00:00:00.018000000
 >       encoder         : Lavc59.15.101 libx264
 > }}}
 >
 > However, encoding yuv420p10le (or yuv444p10le for that matter) does not
 seem to be lossless despite crf 0. The conversion gray10le->yuv420p10le
 (or gray10le->yuv444p10le) is not perfect, but leads to pixel intensity
 errors of only +1 or -1 value on 14.11% of pixels in my example input
 (when total conversion actually is gray10le->yuv420p10le->gray10le, so not
 really a problem, some roundoff error i guess). In the encoded file
 however 68.66% of pixels have the wrong intensity value, with errors
 ranging from -5 to +5 intensity values. I assume this is not expected?
 Should i post a separate ticket for that?



 use full range

 (gray uses full range, but your yuv420p10 conversion uses limited range)

 {{{

 ffmpeg -y -i test.mkv -vf
 "scale=in_range=pc:out_range=pc,format=yuv420p10" -c:v libx264 -preset
 veryfast -crf 0 test2.mp4
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9573#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list