Configure rav1e Color Parameters in FFmpeg
This guide explains how to properly configure color description
parameters—specifically color space, color primaries, and transfer
characteristics—when encoding AV1 video using the rav1e
encoder in FFmpeg. Setting these parameters correctly ensures that your
encoded videos display accurate colors and brightness levels across
different screens, players, and platforms.
Understanding the Color Parameters
When encoding video, you need to define how colors are represented. This is done using three metadata tags, collectively known as the color description:
- Color Primaries (
-color_primaries): Defines the color gamut (the range of colors). Common values includebt709for standard definition/HD andbt2020for ultra-high-definition (UHD) and HDR. - Color Transfer Characteristics
(
-color_trc): Defines the opto-electronic transfer function (gamma curve). Common values includebt709for SDR,smpte2084for HDR10 (PQ), andarib-std-b67for Hybrid Log-Gamma (HLG). - Color Space (
-colorspace): Defines the matrix coefficients used to derive luma and chroma signals from red, green, and blue primaries. Common values includebt709andbt2020nc.
Additionally, you can specify the Color Range
(-color_range), which is typically tv
(limited range, standard for most video) or pc (full
range).
FFmpeg Command Examples for rav1e
FFmpeg’s librav1e wrapper maps standard FFmpeg color
options directly to the encoder. You do not need complex nested
parameters; you can pass the standard flags directly.
Standard Definition / High Definition (SDR BT.709)
For standard 1080p web video, use the BT.709 color space:
ffmpeg -i input.mp4 -c:v librav1e -pix_fmt yuv420p10le -color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv output.mp4High Dynamic Range (HDR10 / BT.2020 PQ)
For high-quality HDR content, use the BT.2020 color gamut and the
SMPTE 2084 (PQ) transfer curve. 10-bit pixel format
(yuv420p10le) is highly recommended for HDR to prevent
color banding:
ffmpeg -i input.mp4 -c:v librav1e -pix_fmt yuv420p10le -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -color_range tv output.mp4Broadcast HDR (HLG / BT.2020)
For HLG-based HDR, which is commonly used in broadcasting, configure the parameters as follows:
ffmpeg -i input.mp4 -c:v librav1e -pix_fmt yuv420p10le -color_primaries bt2020 -color_trc arib-std-b67 -colorspace bt2020nc -color_range tv output.mp4Verifying the Output
After encoding your video, you can verify that the color parameters
were written correctly to the file’s metadata using
ffprobe:
ffprobe -v error -select_streams v:0 -show_entries stream=color_space,color_transfer,color_primaries,color_range -of default=noprint_wrappers=1 output.mp4