Opened 18 months ago
Last modified 18 months ago
#11507 new defect
vpp_qsv tonemapping and color space conversion does not change metadata
| Reported by: | Nathan Fendley | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avfilter |
| Version: | 7.1 | Keywords: | |
| Cc: | Nathan Fendley | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
When you use these options in vpp_qsv on any Intel GPU:
out_color_matrix <string> ..FV....... Output color matrix coefficient set out_color_primaries <string> ..FV....... Output color primaries out_color_transfer <string> ..FV....... Output color transfer characteristics tonemap <int> ..FV....... Perform tonemapping (0=disable tonemapping, 1=perform tonemapping if the input has HDR metadata) (from 0 to 1) (default 0)
the metadata of the output is not changed to match the new color information. On the other hand, tonemap_vaapi does this properly. The video outputs look identical when played in VLC between vpp_qsv and tonemap_vaapi but not identical to playing the original HDR input, so something more than just incorrect metadata may be going on.
How to reproduce:
Use a system with an Intel media engine that has both the VAAPI and QSV APIs working properly, and use any HDR video that's possible to decode with the media engine.
# Does not work as intended, outputs a video that *says* it's BT.2020 with HDR metadata but the video still comes out right % ffmpeg -hwaccel qsv -hwaccel_output_format qsv -i HWDEC_HDR_INPUT.mkv -vf vpp_qsv=scale_mode=hq:format=p010:tonemap=1:out_color_matrix=bt709:out_color_primaries=bt709:out_color_transfer=bt709 -c:v hevc_qsv -global_quality:v 26 -an -sn OUTPUT_BAD_META.mkv # Works as intended, produces correctly tagged BT.709 SDR % ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i HWDEC_HDR_INPUT.mkv -vf tonemap_vaapi=format=p010:m=bt709:p=bt709:t=bt709 -c:v hevc_vaapi -rc_mode ICQ -q:v 26 -an -sn OUTPUT_PROPER.mkv ffmpeg version n7.1 Copyright (c) 2000-2024 the FFmpeg developers built with gcc 14.2.1 (GCC) 20250207 from Arch Linux repos
Relevant mediainfo from source:
Color range : Limited Color primaries : BT.2020 Transfer characteristics : PQ Matrix coefficients : BT.2020 non-constant Mastering display color primaries : Display P3 Mastering display luminance : min: 0.0050 cd/m2, max: 1000 cd/m2 Maximum Content Light Level : 186 cd/m2 Maximum Frame-Average Light Level : 147 cd/m2
from vpp_qsv tonemap (metadata I believe to be false):
Color range : Limited Color primaries : BT.2020 Transfer characteristics : PQ Matrix coefficients : BT.2020 non-constant Mastering display color primaries : Display P3 Mastering display luminance : min: 0.0050 cd/m2, max: 1000 cd/m2 Maximum Content Light Level : 186 MaxCLL_Original : 186 cd/m2 Maximum Frame-Average Light Level : 147 MaxFALL_Original : 147 cd/m2
from tonemap_vaapi:
Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709
Change History (2)
follow-up: 2 comment:1 by , 18 months ago
comment:2 by , 18 months ago
Replying to nyanmisaka:
Tone-mapping in the vpp_qsv filter requires at least an Intel 11th gen CPU (Xe/UHD7xx), not just any Intel GPU.
I'm running this on an Intel Arc Battlemage B580 - in addition to that, tonemap_vaapi does in fact work correctly on my laptop, which has an i7-8650U/UHD 620. It must have some sort of software/GPU compute fallback with VAAPI.



Tone-mapping in the vpp_qsv filter requires at least an Intel 11th gen CPU (Xe/UHD7xx), not just any Intel GPU.
https://github.com/FFmpeg/FFmpeg/blob/52eb0e18db27bf608403675b0a618880009a301f/libavfilter/vf_vpp_qsv.c#L405