Avisynth ColorYUV

From wiki.selur.net
Revision as of 17:57, 21 November 2026 by Selur (talk | contribs) (Avisynth filter documentation (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ColorYUV adjusts luma and chroma of YUV video: gain, offset, gamma and contrast can be set separately for Y, U and V. It also converts between TV and PC range and has two automatic modes. It is a core filter of AviSynth+.

Filtering → Avisynth → Color → Grading

ColorYUV controls in Hybrid
ColorYUV controls in Hybrid

What it does

Each plane is changed with four values (all 0 = no change):

  • Off adds a constant (brighter/darker for Y, a color shift for U/V).
  • Gain multiplies: value × (gain/256 + 1); -256 gives 0, 256 doubles.
  • Gamma bends the curve: value^(1/g) with g = (gamma + 256)/256. Only effective on Y.
  • Contrast scales around the middle: (value − 128) × cont/256 + 128. On U and V this acts as saturation.

Levels converts the range (PC→TV or TV→PC) before these adjustments. AutoWhite centers the color balance per frame, AutoGain stretches luma to the full range per frame. Analyze prints statistics into the picture, Show replaces the picture with a chroma chart.

Settings

Control Parameter Range Hybrid default Meaning
Off (Y/U/V) off_y / off_u / off_v -256–512 0 Offset, on the 8-bit scale (AviSynth+ scales it to the bit depth).
Gain (Y/U/V) gain_y / gain_u / gain_v -256–512 0 Multiplier, see above.
Gamma (Y/U/V) gamma_y / gamma_u / gamma_v -256–512 0 Gamma; the U and V values have no effect.
Contrast (Y/U/V) cont_y / cont_u / cont_v -256–512 0 Contrast; on U/V saturation.
Levels levels no change, PC->TV, TV->PC no change Range conversion, applied first.
Coring opt="coring" on/off off Clips the result to TV range (luma 16–235, chroma 16–240).
Show showyuv on/off off Shows a chroma chart instead of the picture.
Analyze analyze on/off off Prints per-plane average, minimum and maximum into the picture.
AutoWhite autowhite on/off off Centers the color balance per frame; overrides Off U/V.
AutoGain autogain on/off off Stretches luma to the full range per frame.

Example

Luma gain 20 and a small blue reduction (Off U -4) on a 10-bit YUV 4:2:0 source:

ColorYUV(gain_y=20,off_u=-4)

How Hybrid calls it

  • Only values that differ from the defaults are written; with all defaults the call is plain ColorYUV().
  • The values are passed unchanged; AviSynth+ scales them to the bit depth itself.
  • ColorYUV needs YUV input; RGB is converted to YUV first.
  • ColorYUV also offers the common options and can be added to the filter queue several times.

Background

  • AutoWhite can remove color casts, but it may wash out scenes that are dominated by one color.
  • AviSynth+ also knows levels "PC->TV.Y" (luma only) and "TV", and the parameters bits, showyuv_fullrange, f2c, conditional and condvarsuffix; Hybrid does not offer these.
  • After a range conversion ColorYUV sets the frame property _ColorRange accordingly.
  • Tweak values can be expressed with ColorYUV: cont_u = cont_v = (sat − 1) × 256, gain_y = (cont − 1) × 256, off_y = bright.

See also: Avisynth Tweak, Avisynth Levels

Sources