Vapoursynth FixFlicker

From wiki.selur.net
Jump to navigation Jump to search

FixFlicker finds short brightness flashes – one or a few frames clearly brighter than the frames before and after – and replaces them with frames interpolated from their neighbors.

Filtering → Vapoursynth → Frame → Stabilize

FixFlicker controls in Hybrid
FixFlicker controls in Hybrid

What it does

FixFlicker compares the average luma of each frame with its neighbors. A frame (or a run of up to max. flash length frames) that is brighter than both sides by more than min. luma diff. counts as a flash and is rebuilt by the chosen interpolator from the frames around it. It is meant for isolated bright frames, not for slow brightness drift (use Vapoursynth Deflicker for that). A flash on the very first or last frame stays, because one side has no reference.

Requirements

  • mv: CPU; the mvgpu implementation needs Vulkan.
  • svp, svp_gpu: SVP must be installed (only then are they listed).
  • rife: a Vulkan-capable GPU.
  • gmfssfortuna (Windows only): the torch add-on with GMFSS fortuna and an NVIDIA (CUDA) GPU (only then is it listed).

Settings

Control Parameter Range / values Hybrid default Meaning
Method method mv, svp, svp_gpu, rife, gmfssfortuna mv Interpolator that rebuilds the flash frames.
max. flash length max_flash_frames 1 – 10 1 Longest run of frames counted as one flash.
min. luma diff. min_diff 0 – 1 (step 0.0001) 0 Margin, as a share of the full luma range, by which a frame must exceed its neighbors; 0 = any local maximum.
debug debug on/off off Shows the luma per frame and the detection in the preview.
RIFE: Model – RIFE models rife-v4.5 (ensemble) RIFE model (method rife).
RIFE: TTA / UHD – on/off off / off Test-time augmentation; UHD mode for large frames (method rife).
RIFE: scene thresh. – 0 – 1 0.15 Scene change threshold for the chosen SCD tool (method rife); 0 = no scene check. Ignored with the SCD tool mv, which uses its own thresholds.
GMFSS: Model – base, union base GMFSS fortuna model (method gmfssfortuna).
GMFSS: scene thresh. – 0 – 1 0.15 Scene change threshold (method gmfssfortuna).
Tools: MV – mvgpu, mvutensils, mv – MVTools implementation (method mv).
Tools: SCD – scd, misc, std, mv scd Scene change detection (method rife).

Example

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

# removing brightness flashes
clip = FixFlicker(clip, tools={'mv': 'mvutensils', 'scd': 'scd'})

Method rife, otherwise default settings, same source:

# removing brightness flashes
clip = FixFlicker(clip, method="rife", lazy=True, tools={'mv': 'mvutensils', 'scd': 'scd'})

How Hybrid calls it

  • FixFlicker works on YUV clips of any bit depth with mv, rife and gmfssfortuna; SVP converts to 8-bit 4:2:0. RGB is not accepted. min. luma diff. uses normalized luma and does not depend on the bit depth.
  • Options are only written when they differ from the defaults; RIFE and GMFSS options only for their method.
  • In the preview and with the method rife the detection runs per frame (lazy). With the other methods a job measures the whole clip when the script is loaded, so the encode starts only after a full pass over the source.
  • Frame count and frame rate do not change.
  • The interpolators: mv uses MVTools flow interpolation, svp SVP's frame interpolation, rife RIFE (ncnn/Vulkan) with optional scene detection, gmfssfortuna the GMFSS fortuna model.

Sources