Dynamic Range Format presets

Introduction

When transcoding your HDR content, or converting content between different HDR formats or to SDR, you need to get the codec configuration settings that conrol the output color settings just right to ensure that the operation is performed correctly and that you have a valid output file.

To simplify this process, with encoder v2.98.0 and above, we expose a dynamicRangeFormat enum property with a range of possible values for common dynamic range formats.

H265VideoConfiguration h265VideoConfiguration = new H265VideoConfiguration();
h265VideoConfiguration.setHeight(OUTPUT_HEIGHT);
h265VideoConfiguration.setBitrate(OUTPUT_BITRATE);
h265VideoConfiguration.setDynamicRangeFormat(H265DynamicRangeFormat.HDR10);

The value selected sets a number of the relevant individual properties on the codec configuration. The tables below show those properties and assigned values, for each supported codec configuration.

You may still overwrite any of the individual settings if necessary.

H265 Video Configuration

PresetSDRHLGHDR10DOLBY_VISION
profile^mainmain10main10main10
pixelFormatYUV420PYUV420P10LEYUV420P10LEYUV420P10LE
hdr-truetrue-
enableHrdSignaling---true
colorConfig.colorPrimariesBT709BT2020BT2020UNSPECIFIED
colorConfig.colorTransferBT709ARIB_STD_B67SMPTE2084UNSPECIFIED
colorConfig.colorSpaceBT709BT2020_NCLBT2020_NCLUNSPECIFIED
colorConfig.colorRange---JPEG
colorConfig.copyColorTransferFlagfalsefalsefalsefalse
colorConfig.copyColorPrimariesFlagfalsefalsefalsefalse
colorConfig.copyChromaLocationFlagfalsefalsefalsefalse
colorConfig.copyColorSpaceFlagfalsefalsefalsefalse
colorConfig.copyColorRangeFlagfalsefalsefalsefalse
masterDisplay*--G(8500,39850) B(6550,2300) R(35400,14600) WP(15635,16450) L(10000000,1)G(13250,34500) B(7500,3000) R(34000,16000) WP(15635,16450) L(10000000,1)

* whitespaces and carriage return in the table are for readibility. The actual string used in the APIs does not contain any whitespace ^ the profile set by the PresetConfiguration will be overwritten as needed

H264 Video Configuration

PresetSDR
profilemain
colorConfig.colorPrimariesBT709
colorConfig.colorTransferBT709
colorConfig.colorSpaceBT709
colorConfig.copyColorTransferFlagfalse
colorConfig.copyColorPrimariesFlagfalse
colorConfig.copyChromaLocationFlagfalse
colorConfig.copyColorSpaceFlagfalse
colorConfig.copyColorRangeFlagfalse

VP9 Video Configuration

PresetSDRHLG
colorConfig.colorPrimariesBT709BT2020
colorConfig.colorTransferBT709ARIB_STD_B67
colorConfig.colorSpaceBT709BT2020_NCL
colorConfig.copyColorTransferFlagfalsefalse
colorConfig.copyColorPrimariesFlagfalsefalse
colorConfig.copyChromaLocationFlagfalsefalse
colorConfig.copyColorSpaceFlagfalsefalse
colorConfig.copyColorRangeFlagfalsefalse

Input color

In the background, the encoder decides which conversion to apply based only on the input type and the output configuration. If there is no dynamicRangeFormat specifically set in the video configuration, the encoder will keep the output color space the same as found in the input.

The input color configuration can be specified in the API, and if not specified will be deduced during the internal decoding process. If the input color is not specified and the encoder fails to properly deduce the input color configuration, it will be assumed that the colorspace is:

  • BT470BG if the input resolution is SD
  • BT709 for input resolution of HD (720p) or above
  • BT2020 for input resolutions of 4K or above