ffmpeg destroys HDR metadata when encoding
|Reported by:||mario66||Owned by:||Carl Eugen Hoyos|
|Cc:||firstname.lastname@example.org, email@example.com, dc, thovo||Blocked By:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
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 y=0.329000 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.
Change History (87)
comment:3 by , 6 years ago
|Component:||undetermined → avcodec|
|Priority:||important → normal|
follow-up: 35 comment:26 by , 4 years ago
|Priority:||normal → critical|
comment:55 by , 4 years ago
|Priority:||normal → important|
|Summary:||ffmpeg destroys HDR information when encoding → ffmpeg destroys HDR metadata when encoding|