Skip to content

Matrix Coefficients

currentMigrated from docs/colorimetry/matrix.mdx at 37c3317fd058; modified for Encode Wiki · CC BY-SA 4.0

Matrix coefficients define how gamma-encoded R′G′B′ is turned into one luma (Y′) and two color-difference (Cb, Cr) components, and therefore how a player turns them back. For the common systems the matrix is set by two weights, KR and KB: luma is KR·R′ + (1−KR−KB)·G′ + KB·B′. ffprobe reports the matrix as color_space.

The matrix is independent of primaries, transfer and range, although in practice each video system uses a fixed combination of all four.

CodeFFmpeg nameCoefficients / meaningWhere you see it
0gbrIdentity: the planes are G, B, RRGB video, lossless screen captures, 4:4:4 RGB encodes
1bt709KR 0.2126, KB 0.0722HD and most web video
2unknownNot specifiedUntagged files; the player guesses
4fccKR 0.30, KB 0.11Obsolete
5bt470bgKR 0.299, KB 0.114 (BT.601)PAL/SECAM SD; also sYCC and JPEG-style YCbCr
6smpte170mSame coefficients as 5NTSC SD, DVD
7smpte240mKR 0.212, KB 0.087Early 1990s HDTV; obsolete
8ycgcoYCgCoRare
9bt2020ncKR 0.2627, KB 0.0593, non-constant luminanceUHD and HDR (HDR10, HLG)
10bt2020cBT.2020 constant luminanceSpecified but almost never used
11smpte2085Y′D′zD′xRare
12 / 13chroma-derived-nc / chroma-derived-cCoefficients computed from the signalled primariesRare
14ictcpBT.2100 ICtCpRare in delivery
15ipt-c2IPT-C2Dolby Vision profile 5
16 / 17ycgco-re / ycgco-roReversible YCgCoLossless coding

Codes 5 and 6 are the same matrix, so for conversion purposes “BT.601” covers both; tag whichever matches the source system. Other tools use other spellings for the same numbers: SVT-AV1 uses bt601 for 6 and bt2020-ncl for 9, VapourSynth uses 170m and 2020ncl.

Decoding with the wrong matrix barely changes grays, but it shifts saturated colors: reds, greens and skin tones are where you notice it. It is easy to miss without the source next to the encode. The usual causes:

  • Untagged SD upscaled to HD. The SD source is BT.601. After scaling to 1080p, players that guess by resolution switch to BT.709. mpv, for example, assumes BT.709 when the width is at least 1280 or the height is above 576.
  • Tagging instead of converting. Writing bt709 onto BT.601 pixels changes nothing in the pixels; it makes every player decode them wrongly.
  • RGB sources converted by FFmpeg. Converting PNG frames, screen captures or other RGB input to YUV uses the BT.601 matrix by default and leaves the output untagged, which an HD player then decodes as BT.709.

When the resolution class changes, convert the matrix at the same time as scaling. Commands for FFmpeg zscale and VapourSynth resize are in the color guide. For RGB input, choose the matrix explicitly and tag the result:

Terminal window
ffmpeg -i input.png -vf scale=out_color_matrix=bt709,format=yuv420p,setparams=color_primaries=bt709:color_trc=bt709 -c:v libx264 output.mkv

BT.2020 constant and non-constant luminance

Section titled “BT.2020 constant and non-constant luminance”

bt2020nc (9) is the normal choice for UHD SDR, HDR10 and HLG; BT.2100 uses the same non-constant-luminance Y′CbCr. bt2020c (10) is a different signal and needs different maths to decode, so changing the tag from 9 to 10, or the reverse, is never a fix. ICtCp (14) is a separate HDR representation from BT.2100, not a variant of BT.2020 Y′CbCr.