[FFmpeg-trac] #7037(undetermined:new): ffmpeg destroys HDR information when encoding

FFmpeg trac at avcodec.org
Thu Feb 22 01:31:59 EET 2018

#7037: ffmpeg destroys HDR information when encoding
             Reporter:  mario66      |                     Type:  defect
               Status:  new          |                 Priority:  important
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:  hdr          |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 Summary of the bug:


 I have a new 4k bluray with a 10 bit HDR movie and I now want to convert
 it to 1080p with x265, but keep the HDR.

 I downloaded a ffmpeg binary build against 10 bit x265 and started the
 conversion with '-vf "scale=1920x1080"' option. While the resultsing video
 is indeed encoded with the Main10 profile, the video itself looks dull and
 as if the HDR information was lost. I notice that metadata changed.

 In the original video, there are the following tags:
 colour_range                             : Limited
 colour_primaries                         : BT.2020
 transfer_characteristics                 : PQ
 matrix_coefficients                      : BT.2020 non-constant
 MasteringDisplay_ColorPrimaries          : R: x=0.680000 y=0.320000, G:
 x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700
 MasteringDisplay_Luminance               : min: 0.0050 cd/m2, max:
 4000.0000 cd/m2
 MaxCLL                                   : 500 cd/m2
 MaxFALL                                  : 200 cd/m2

 In my new video, these are not included any more. I consider this to be a
 BUG because I never told ffmpeg to mess with color spaces etc. therefore
 ffmpeg should just leave everything as it is including the metadata.

 How to reproduce:

 % ffmpeg -i in.mkv -vf "scale=1920x1080" -map 0:v -map 0:a? -map 0:s? -c:v
 libx265 [-pix_fmt yuv420p10le] -c:a copy -c:s copy out.mkv
 The argument in square brackets is an alternative I tried but the result
 is the same.


Ticket URL: <https://trac.ffmpeg.org/ticket/7037>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list