Skip to main content
Version: v5.9.0

HDR

Quadra completely supports 3 HDR standards, HLG, HDR10 and HDR10+ for H.264, H.265, and AV1. These standards all use 10 bit color for greater dynamic range, a wider range of colors as per ITU-R BT.2020. For Dolby Vision, Quadra supports a compatibility mode such that the Dolby Encoding Engine can use the Quadra encoder for single base layer profile 5 Dolby Vision encoding with H.265. This mode is enabled by setting the encoding parameter dolbyVisionProfile=5.

HDR10/10+ uses a Perceptual Quantization transfer curve as per SMPTE ST 2084 that supports a much larger range of brightness but is not backwards compatible with standard dynamic range (SDR). The colors of HDR10/10+ content played back on an SDR monitor will appear very faded. HLG on the other hand uses the ARIB STD-B67 transfer curve which provides greater dynamic range at high brightness and is backward compatible with the SDR gamma curve at low brightness and so an HLG stream can be played on both SDR and HDR monitors.

The HDR colour information is carried in the VUI for H.264 and H.265 and in the metadata OBU for AV1.

The following 3 standards specify the HDR colour information:

StandardVUI Color Information
HLG
ATSC A/341
color_primaries=9 (ITU-R BT.2020-2 Wide Gamut Color) transfer_characteristics=18 (ARIB STD-B67 HLG Transfer Curve)

matrix_coeffs=9 (ITU-R BT.2020-2 Non-constant Luminance)
HLG
ETSI ETSI TS 101 154
color_primaries=9 (ITU-R BT.2020-2 Wide Gamut Color) transfer_characteristics=14 (ITU-R BT.2020-2 Functionally equivalent to BT.709)

matrix_coeffs=9 (ITU-R BT.2020 Non-constant Luminance)
HDR10/10+color_primaries=9 (ITU-R BT.2020-2 Wide Gamut Color) transfer_characteristics=16 (SMPTE ST2084 PQ Transfer Curve)

matrix_coeffs=9 (ITU-R BT.2020-2 Non-constant Luminance)

HDR bitstreams may also carry static metadata containing the parameters of the mastering display using content light level info, and the mastering display color volume.

HDR10+ adds dynamic metadata that can update the color information on a frame by frame basis. This metadata is stored in T35 payloads as per SMPTE 2094-40. The HDR metadata is stored using SEIs for H.264 and H.265 or equivalent metadata OBU types for AV1.

There are no special commands to enable HDR transcoding. The Quadra decoder will pass HDR color information and HDR metadata up to FFmpeg if the bitstream contains it, and the Quadra encoder will insert the HDR color information and metadata in the encoded bitstream if supplied by FFmpeg. Transcoding a compliant HDR10 bitstream will result in a compliant HDR10 bitstream. The same for HDR10+ and HLG.

FFmpeg supports specifying the color information on the command line with 3 parameters that map to the VUI color parameters as follows. These parameters may be specified in the input or output sections of the FFmpeg command line. If the color information is specified on the command line, it will replace any color information that is contained in the input media.

These will be properly set by the decoder if transcoding.

FFmpeg Color ParameterVUI Color Parameter
color_primariescolor_primaries
color_trctransfer_characteristics
colorspacematrix_coeffs

The following is an example FFmpeg command line to encode a 10 bit HLG YUV file to H.265 as per ATSC requirements:

ffmpeg -f rawvideo -pix_fmt yuv420p10le -s:v 3840x2160 -r 60 -color_primaries 9 -color_trc 18 -colorspace 9 -i Input_3840x2160_10bit_le.yuv -enc 0 -c:v h265_ni_quadra_enc -xcoder-params "RcEnable=1:bitrate=20000000" outputATSCHlgT408.265
note

While ETSI specifies transfer characteristics=14 for HLG in the VUI, they also specify the inclusion of an alternative transfer characteristics SEI that specifies a preferred transfer characteristics of 18. The Netint decoder will return the preferred transfer characteristics instead of the VUI transfer characteristics if this SEI is present. The NETINT Encoder has a parameter (prefTRC) to specify the inclusion of this SEI, and to set its value.

For example, the following command line to encode a 10 bit HLG YUV file to H.265 as per ETSI requirements is as follows:

ffmpeg -f rawvideo -pix_fmt yuv420p10le -s:v 3840x2160 -r 60 -color_primaries 9 -color_trc 14 -colorspace 9 -i Input_3840x2160_10bit_le.yuv -enc 0 -c:v h265_ni_quadra_enc -xcoder-params "RcEnable=1:bitrate=20000000:prefTRC=18" outputETSIHlgT408.265
note

FFmpeg does not currently support specifying the static and dynamic metadata for HDR10/10+

An example of HDR transcoding between H.265 to H.264 is as follows. If the input is 10 bits, then the output will be 10 bits. Any HDR VUI color information from the input bitstream will be transferred to the output bitstream. Any static or dynamic HDR10/10+ metadata from the input bitstream will be transferred to the output bitstream. When a ETSI HLG bitstream is decoded, the preferred transfer characteristics will be used in the VUI of the output bitstream.

ffmpeg -c:v h265_ni_quadra_dec -dec 0 -i inputHDR.ts -c:a copy -enc 0 -c:v h264_ni_quadra_enc -xcoder-params "RcEnable=1:bitrate=20000000" outputHDR.ts

If an ETSI compliant output bitstream is required then the VUI transfer characteristics can be overwritten on the command line and the preferred transfer characteristics specified.

ffmpeg -c:v h265_ni_quadra_dec -dec 0 -i inputHDR.ts -c:a copy -color_trc 14 -c:v h264_ni_quadra_enc -enc 0 -xcoder-params "RcEnable=1:bitrate=20000000: prefTRC=18" outputHDR.ts
note

HLG is supported in all supported versions of FFmpeg. HDR10 is supported in FFmpeg version 4.1.3 or higher, while HDR10+ and Dolby Vision compatibility are supported in FFmpeg 4.2.1 or higher.