Avisynth AutoAdjust

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

AutoAdjust corrects levels, gamma, saturation and white balance automatically. It measures every frame, averages the measurements over neighboring frames (never across a scene change) and derives a smooth correction from them, so the picture does not pump from frame to frame.

Filtering → Avisynth → Color → Auto

AutoAdjust controls in Hybrid
AutoAdjust controls in Hybrid

What it does

AutoAdjust has two independent parts:

  • Auto Gain moves the black point, white point and gamma towards the measured range and adjusts saturation along with it.
  • Auto Balance shifts U and V so that the average color becomes neutral, which removes color casts.

With neither part enabled, AutoAdjust does nothing and Hybrid leaves it out of the script.

Settings

Control Parameter Range Hybrid default Meaning
Temporal radius temporal_radius 1–120 20 Number of frames before and after the current one that are averaged.
Scene Change scd_threshold 1–100 12 Scene change threshold in percent; useful values are 8–16.
Interpolation use_interp on/off on Smooths the correction (not the picture) to avoid banding.
High quality high_quality on/off off Slower, smoother interpolation; only with Interpolation on.
Dither use_dither on/off on Dithers when rounding, against banding.
DebugView debug_view on/off off Debug output of the plugin.
Auto Gain (auto_gain)
Limit (dark/bright/gamma) dark_limit / bright_limit / gamma_limit 1.0–10.0 1.50 / 1.50 / 1.25 How far black point, white point and gamma may move; 1.0 = no change.
Exclude (dark/bright) dark_exclude / bright_exclude 0.0–1.0 0.50 / 0.50 Percent of the darkest/brightest pixels ignored when measuring black and white point.
Gain mode gain_mode contrast expansion, levels adjustment contrast expansion Contrast expansion stretches below and above the average separately; levels adjustment does one linear stretch.
Chroma processing chroma_process 0–200 100 How much of the luma gain is applied to the saturation, in percent.
Safety avg_safety 0.0–1.0 0.25 0 = more stable, 1 = more conservative black and white points.
TV input input_tv on/off on Limits the measured range to 16–235; switch off for full-range sources.
TV output output_tv on/off on Keeps the result within 16–235.
Auto Balance (auto_balance)
Chroma limit chroma_limit 1.0–2.0 1.05 Maximum U/V shift; 1.0 = none, 2.0 = unlimited.
Balance balance_str 0.0–1.0 0.75 Strength of the balance correction.

Example

Auto Gain and Auto Balance with default values on a 10-bit YUV 4:2:0 source:

# Converting from 10 to 16bit for AutoAdjust
ConvertBits(16)
ConvertToStacked()
AutoAdjust(auto_gain=true,auto_balance=true,high_bitdepth=true)
ConvertFromStacked(16)
# Converting from 16 to 10bit for encoder
ConvertBits(10)

How Hybrid calls it

  • Hybrid loads AutoAdjust.dll (and ConvertStacked.dll for high bit depth).
  • 8-bit clips use AutoAdjust() directly. For other bit depths Hybrid converts to 16 bit, then to the stacked layout, calls AutoAdjust with high_bitdepth=true and converts back.
  • Only values that differ from the defaults are written; the Auto Gain and Auto Balance values only when their group is enabled.
  • Accepted formats: YUV 4:1:1, 4:2:0, 4:2:2 and 4:4:4 with even width and height (no RGB); other formats are converted first.
  • AutoAdjust also offers the common options and can be added to the filter queue several times.

Background

AutoAdjust was written by LaTo; Hybrid's AviSynth branch uses LaTo's plugin (version 2.60). The Vapoursynth branch uses Selur's clean-room port, which handles 8–16 bit natively.

The plugin has further parameters that Hybrid does not offer: an external clip for the measurements (external_clip), a manual list of scene changes (change_status) and thread/CPU settings.

See also: Vapoursynth AutoAdjust, Avisynth AutoLevels

Sources

  • AutoAdjust port (README, parameter descriptions)
  • Hybrid's tooltips
  • The AviSynth+ documentation does not cover AutoAdjust.