Vapoursynth Deflicker: Difference between revisions

From wiki.selur.net
Jump to navigation Jump to search
New filter page (via create-page on MediaWiki MCP Server)
 
Update to current Hybrid behaviour; code as <pre> (via update-page on MediaWiki MCP Server)
 
Line 30: Line 30:
== Example ==
== Example ==
Default settings on a 10-bit YUV 4:2:0 source (640x356):
Default settings on a 10-bit YUV 4:2:0 source (640x356):
<syntaxhighlight lang="python">
<pre>
# stabilizing mean luma using Deflicker
# stabilizing mean luma using Deflicker
clip = core.deflicker.Deflicker(clip)
clip = core.deflicker.Deflicker(clip)
</syntaxhighlight>
</pre>


== How Hybrid calls it ==
== How Hybrid calls it ==

Latest revision as of 09:48, 16 November 2026

Deflicker evens out the brightness flicker of old film transfers by smoothing the mean luma of each frame towards that of the neighboring frames. It can also tame the brightness "pumping" of camcorder auto gain after flashes.

Filtering → Vapoursynth → Frame → Stabilize

Deflicker controls in Hybrid
Deflicker controls in Hybrid

What it does

For every frame Deflicker measures mean and spread of the luma and corrects the frame with one global gain and offset, so these values follow the previous frames (or, with a negative Lag, the following frames). The compensation is deliberately partial (Percent). Only luma is changed; chroma is copied. Scene changes and nearly flat frames restart the estimation, so the smoothing never crosses a cut.

Settings

Control Parameter Range / values Hybrid default Meaning
Percent percent 0 – 100 (step 0.1) 85 How strongly the mean luma of the previous frames is followed; 100 = full compensation, 0 = none.
Lag lag −100 – 100 25 Largest distance in frames to the base frame; negative values estimate from the following frames (e.g. −25 against auto-gain pumping); 0 leaves the clip unchanged.
Noise noise 0 – 255 (step 0.1) 10 Standard deviation of the luma noise; frames whose spread is not above it count as flat and end the propagation (8-bit scale).
Scene scene 0 – 255 40 Scene change threshold (jump of the mean luma); lower values detect more cuts (8-bit scale).
Luma (min/max) lmin / lmax 0 – 255 each 0 / 255 Output luma limits (8-bit scale; 255 always means the format maximum). The minimum can not exceed the maximum.
Border border 0 – 100 px 0 Band at all edges that is left out of the measurement; the whole frame is still corrected. It must leave part of the frame, so very small frames allow only small values.
Info info on/off off Draws the measured values and the measured area into the frame. The overlay ends up in the encode too.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# stabilizing mean luma using Deflicker
clip = core.deflicker.Deflicker(clip)

How Hybrid calls it

  • Deflicker works on gray and YUV clips, 8–16-bit integer and 32-bit float; RGB is converted to YUV first. Interlaced material is filtered as separated fields.
  • Noise, Scene and the luma limits stay on the 8-bit scale for every format; the plugin scales them.
  • Values are only written when they differ from the defaults (Hybrid's defaults are the plugin's).
  • Frame count and frame rate do not change.
  • Deflicker also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

Algorithm

Deflicker is a simplified version of the AURORA intensity-flicker correction (van Roosmalen, 1999): flicker is modelled as a multiplicative and an additive change per frame, and mean and variance are propagated from a base frame for up to Lag frames. The correction is global, without motion compensation, so it fits best after a global motion compensation and before motion-compensated denoising. To tune Scene, switch on Info and adjust it until only real cuts are marked as new scenes.

Versions

The filter was written by Fizick for AviSynth (2004) and continued by pinterf. Version 0.7.0 adds VapourSynth, high bit depth and float support, and Linux/macOS builds; its 8-bit output is identical to 0.6. It runs on the CPU.

For short bright flashes on single frames see Vapoursynth FixFlicker; for per-pixel shimmer see Vapoursynth ReduceFlicker.

Sources