[Request]: Add ability to specify chroma location when encoding
Is your feature request related to a problem? Please describe. Recording an HDR video with OBS, chroma location is listed as Left instead of Top-Left in Media Information of VLC 3.0.17.4. (Does not appear in 3.0.16, so get latest.)
Describe the solution you'd like I'd like AMF to provide properties to set chroma location, so OBS can use it for HDR recordings.
This is what OBS does with NVENC for example: https://github.com/obsproject/obs-studio/blob/1b574196701e84da0d48af8a42d2a57f273181e3/plugins/obs-ffmpeg/jim-nvenc.c#L750
Describe alternatives you've considered N/A
Additional context N/A
According to the H264 and H265/HEVC syntax, chroma location fields are optional and their presence is controlled by a Boolean flag (chroma_loc_info_present_flag). The AMF encoder sets this flag to 0, meaning that the decoding app should use the default values (zeros).
This is from H.265 (08/21): https://www.itu.int/rec/T-REC-H.265-202108-I
When chroma_format_idc is equal to 1 (4:2:0 chroma format) and the decoded video content is intended for interpretation according to Rec. ITU-R BT.2020-2 or Rec. ITU-R BT.2100-2, chroma_loc_info_present_flag should be equal to 1, and chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field should both be equal to 2.
When transforming to 4:2:0, OBS does output chroma sampled from top-left for Rec. 2100 output types (left otherwise), so it seems like it needs to be able to set this metadata to conform to spec.
Yes, you are right. We will add an AMF property for applications to properly code the chroma location syntaxes inside the VUI parameters.