Avisynth AutoLevels
AutoLevels corrects levels and optionally gamma automatically. Unlike a per-frame correction, it averages the luma statistics over a window of frames and stops at scene changes, so the brightness does not jump between frames. Good for footage that is too dark, too bright or too flat, or whose exposure drifts.
Filtering → Avisynth → Color → Auto

What it does
For each frame AutoLevels measures the darkest, brightest and mean luma, averages these values over Radius frames on each side (within the current scene) and stretches the measured range to the output levels (16–235 for limited YUV). With Auto gamma it also estimates a gamma that moves the mean towards Midpoint. Fade protection scales the correction down in frames with a small luma range, so fades are not stretched.
Settings
| Control | Parameter | Range | Hybrid default | Meaning |
|---|---|---|---|---|
| Radius | filterRadius | 0–60 | 7 | Frames on each side that are averaged; 0 = current frame only. |
| Scene change | sceneChgThresh | 0–255 | 20 | A scene change is detected if minimum or maximum luma jump by this much (or the mean by half of it); 255 = off. |
| 2nd test (th/%) | sc2th / sc2Perc | 0–256 / 0–99.99 | 12 / 33.33 | A detected change only counts if more than sc2Perc percent of the pixels differ by more than sc2th; sc2th 256 = test off. |
| Auto level | autolevel | on/off | on | Stretches the measured range to the output levels. |
| Auto gamma | autogamma | on/off | off | Estimates the gamma automatically; replaces Gamma. |
| Gamma | gamma | 0.1–10 | 1.0 | Manual gamma like in Levels; only without Auto gamma. |
| Midpoint | midpoint | 0.01–0.99 | 0.5 | Target mean for Auto gamma (0.4 often looks nicer). |
| Gammax | gammax | 1.0–10 | 1.5 | Upper limit of the automatic gamma. |
| Gammin | gammin | 0.1–1.0 | off (0.67) | Lower limit of the automatic gamma; off = 1/Gammax. |
| Fixed input (low/high) | input_low / input_high | 0–255 | off (16 / 235) | Fixed black and white input levels instead of the measured ones. |
| Fixed output (low/high) | output_low / output_high | 0–255 | off (16 / 235) | Target levels; off = 16/235 for limited YUV, 0/255 for RGB and full-range YUV. |
| Coring | coring | on/off | off | Expands 16–235 to 0–255 before the mapping and back afterwards, like Levels with coring; ignored for RGB. |
| Ignore (low/high) | ignore_low / ignore_high | 0–0.45 | 0.001953 | Fraction of the darkest/brightest pixels ignored when measuring (default 1/512). |
| Border (l/r/t/b) | border_l / border_r / border_t / border_b | 0–4096 | 0 | Pixel bands excluded from the measurement only, e.g. black borders. |
| Fade protection | minRng | 64–128 | on (100) | If the luma range of a frame is below this value, the correction is reduced. |
| Frame overrides | frameOverrides | text | – | S = force a scene start, N = no scene start, E = leave frames untouched; e.g. E8400-8405,S62908,N8527-8540.
|
| Debug | debug | on/off | off | Draws per-frame statistics into the picture; not for encoding. |
Example
Automatic levels with automatic gamma on a 10-bit YUV 4:2:0 source:
# adjusting levels and gamma using AutoLevels AutoLevels(autogamma=true)
How Hybrid calls it
- Hybrid loads AutoLevels.dll and writes only values that differ from the defaults, so the default call is plain
AutoLevels(). - Level values are entered on the 8-bit scale at every bit depth; the plugin scales them itself.
- Fixed input/output levels and Gammin are only written when ticked. Fade protection off writes
minRng=0. - Frame numbers in Frame overrides refer to the clip at the filter's position (after cuts). Invalid entries are dropped and named in a script comment.
- Accepted formats: YUV and gray 8–16 bit, planar RGB 8–16 bit; float is converted first.
- Full-range YUV is detected by the plugin from the clip's frame properties.
- AutoLevels also offers the common options and can be added to the filter queue several times.
Background
Hybrid uses Selur's port AutoLevels 1.1.0, one DLL for AviSynth+ and VapourSynth. It is based on AutoLevels 0.12 beta 3 (2019) by Theodor Anschütz, Jim Battle and StainlessS; with 8-bit input the result is bit-identical to the original. The port adds 10–16 bit, planar RGB, multithreading and full-range detection.
There is no separate AutoGamma entry: Auto level off plus Auto gamma on does the same, with Gammax set to 10 to match AutoGamma's default.
See also: Vapoursynth AutoLevels, Avisynth AutoAdjust, Avisynth Levels
Sources
- AutoLevels repository (README)
- Hybrid's tooltips
- The AviSynth+ documentation does not cover AutoLevels.