Vapoursynth AutoWhite

From wiki.selur.net
Revision as of 17:24, 14 November 2026 by Selur (talk | contribs) (New page: Auto white (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Auto white is a simple automatic white balance that works frame by frame: it measures the average of the red, green and blue planes and applies a gain per channel that pulls them towards each other.

Filtering → Vapoursynth → Color → Auto

Auto white controls in Hybrid
Auto white controls in Hybrid

What it does

For every frame the average of each RGB plane is measured. Each channel gets a correction relative to the brightest channel; the corrections are normalized and applied as gains, so a color cast is removed and a neutral gray frame stays unchanged.

Because each frame is measured on its own, the correction can change from frame to frame, which makes the filter unsuitable for most material. The normalization also makes strongly tinted frames darker.

Settings

Auto white has no settings of its own; it is just switched on or off.

Control Parameter Values Hybrid default Meaning
Tools: Expr tools akarin, cranexpr, std akarin (std without AVX2) Expression evaluator that applies the gains.
Tools: PlaneStats tools vszip, std vszip Plugin that measures the plane averages.

Example

On a 10-bit YUV 4:2:0 source:

# adjusting color space from YUV420P10 to RGB30 for vsAutoWhite
clip = core.resize.Bicubic(clip=clip, format=vs.RGB30, matrix_in_s="470bg", range_in_s="limited", range_s="full")
# adjusting colors using AutoWhite
clip = color.AutoWhite(clip, tools={'expr': 'akarin', 'planestats': 'vszip'})
# adjusting output color from RGB30 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_in_s="full", range_s="limited")

How Hybrid calls it

  • The filter works on integer RGB; Hybrid converts the clip to RGB first.
  • Auto white also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The script

The function follows the GrayWorld1 example from VapourSynth's FrameEval documentation: the plane averages are measured with std.PlaneStats (or vszip's PlaneAverage), std.FrameEval reads them per frame, computes the gains and applies them with an expression.

VapourSynth

The VapourSynth core has no auto white function. The FrameEval page of the documentation contains the example this filter is based on.

AviSynth

AviSynth has no dedicated filter. The closest is ColorYUV's autowhite, which works in YUV and centers the U/V offsets; the documentation warns that it is not intelligent, e.g. a clear blue sky can come out gray.

Sources