Ch. 14 · HDR Workflow in Practice

한국어日本語
7 min

HDR Encoding with SVT-AV1, and What You Must Verify

AV1 puts color information in the sequence header. The option names differ from x265, and verifying that the metadata actually made it in is essential.

SVT-AV1 can also carry 10-bit HDR. The color tags (primaries, transfer, matrix) go into the AV1 bitstream, while mastering and content light level information are handled as separate metadata. However, the option names and support status differ from x265, and behavior has changed depending on the ffmpeg and SVT-AV1 versions, so the check you run after encoding is especially important.

SVT-AV1 10-bit + HDR10 metadata (check the option names against the docs for the version you're using)
ffmpeg -i input_hdr.mov \
  -c:v libsvtav1 -preset 6 -crf 30 \
  -pix_fmt yuv420p10le \
  -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc \
  -svtav1-params "color-primaries=9:transfer-characteristics=16:matrix-coefficients=9:mastering-display=G(0.265,0.69)B(0.15,0.06)R(0.68,0.32)WP(0.3127,0.329)L(1000,0.0001):content-light=1000,400" \
  -an output_av1_hdr.mp4
x265SVT-AV1
Specifying the PQ transfer functiontransfer=smpte2084transfer-characteristics=16
Units for mastering infoIntegers (units of 0.00002 / 0.0001 nit)Decimal coordinates and nit values are commonly used
Content light levelmax-cll=MaxCLL,MaxFALLcontent-light=MaxCLL,MaxFALL
Where the metadata is storedHEVC SEIAV1 metadata OBU / sequence header

The two encoders take the same numbers in different units. Don't copy the notation over as is; convert the units.

"I set it, but it didn't go in" has actually been reported

The ffmpeg mailing lists and issue trackers are known to contain reports of HDR metadata missing from SVT-AV1 output (with specific version combinations). The only way to know how your current versions behave is to check a file you made yourself. Open the output file with ffprobe and look for the color trio and the side data (Mastering display metadata, Content light level metadata).

Verifying the output file: check the color tags and HDR side data
ffprobe -v error -select_streams v:0 \
  -show_entries stream=codec_name,pix_fmt,color_primaries,color_transfer,color_space \
  -show_entries stream_side_data \
  output_av1_hdr.mp4

# Expected values (for PQ / BT.2020 video)
# pix_fmt=yuv420p10le  color_primaries=bt2020  color_transfer=smpte2084  color_space=bt2020nc

AV1 playback support differs from device to device, so check your target environment first with the Codec Support Checker. You can build a basic command skeleton with the ffmpeg Command Builder.

OBUOpen Bitstream Unit

The basic unit that makes up an AV1 bitstream. The sequence header and metadata are also carried in OBUs.

Side dataSide data

Supplementary information that ffmpeg/ffprobe attaches to frames and streams and displays. HDR mastering info shows up here too.

Check yourself

What is the first thing to check after an HDR encode finishes?