Skip to content
Edith

Docs

Command reference

Encoded video grading domains

Back to the CLI reference

gradingMode: "ffmpeg709" supports an explicit per-clip gradingDomain. Use it to distinguish photo RGB codes from BT.709 video codes before applying brightness, contrast and saturation. Defaults remain gradingMode: "native" and gradingDomain: "srgb".

Domain EQ input RGB codes Interpretation of graded RGB codes
srgb sRGB sRGB
bt709 Core Video BT.709 Core Video BT.709
bt709ToSRGB Core Video BT.709 sRGB

The two video domains require gradingMode: "ffmpeg709". There is no automatic guess based on the filename, container or clip type. Inspect the source transfer and the reference pipeline's output interpretation. A video tagged with an sRGB transfer still uses the srgb domain. A BT.709 matrix alone does not establish the transfer function.

For mixed reference pipelines that EQ BT.709 video code values but place those values into an sRGB final raster, use:

JSON
{  "visualEffects": {    "clipID": "video",    "effects": {      "gradingMode": "ffmpeg709",      "gradingDomain": "bt709ToSRGB",      "contrast": 1.02,      "saturation": 1.035,      "brightness": 0.002,      "framing": "fill"    }  }}

Use bt709 instead when the graded reference remains BT.709 video and is viewed with that transfer interpretation. Photo clips can keep srgb or omit the domain. Omitted settings reset to defaults when visualEffects replaces the settings object, so include background, crop-independent framing and animation settings that the clip should retain.

Why the domains differ

AVFoundation decodes a tagged video into a color-managed Core Image graph. Encoding those linear working values as sRGB before EQ does not recover the source video's BT.709 encoded values. A difference of several RGB8 levels can therefore remain even when frame content, matrix, range and numeric EQ controls agree. A post-render tone curve is insufficient: EQ clipping and quantization already happened in the wrong domain, and such a curve would also affect text.

The video domains instead color-match the composed image from working linear sRGB into the BT.709 video profile created by CVImageBufferCreateColorSpaceFromAttachments, with BT.709 primaries, transfer and matrix attachments. This follows the same platform interpretation as the AVFoundation decoder. It deliberately does not substitute the distinct CGColorSpace.itur_709 display profile or a hand-written approximate gamma.

The existing fixed-point limited-range YUV444 EQ runs on those RGB8 codes. After EQ, the chosen domain converts the resulting codes back into working linear color using either the video profile or the sRGB transfer. Captions and other overlays are composed afterward. Preview, frame extraction, contact sheets and encoded delivery use this same graph.

Full-range and legal-range source decoding happens once in AVFoundation. The grading stage operates on decoded RGB and uses EQ's limited-range YUV intermediate, so it does not apply a second source-range expansion. Exposure, crop, framing and background composition still happen before EQ.

Output color and reference normalization

gradingDomain defines a clip's grade, not the delivery container's tags. The project and delivery color-space settings still control output encoding. For example, bt709ToSRGB can be delivered as a correctly tagged Rec.709 or P3 video while preserving its intended sRGB-normalized appearance. P3 output does not turn EQ into a wide-gamut algorithm: the grade's intermediate remains RGB8 with BT.709/sRGB primaries. P3 sources are color-managed into that domain.

Comparisons must normalize both artifacts using their actual color metadata. For an independent raw FFmpeg RGB reference, assigning sRGB to the returned codes represents bt709ToSRGB; assigning the Core Video BT.709 profile represents bt709. Changing the interpretation is not a color conversion and must be an explicit part of the reference contract. An untagged PNG, a tagged BT.709 video and a color-managed screenshot are not interchangeable references.

Accuracy

bt709ToSRGB keeps graded video within about one RGB level on average of FFmpeg's eq filter, for full- and limited-range H.264 and HEVC sources, both in extracted frames and in delivered video. The default srgb domain does not change.