Vapoursynth StabilizeIT

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

StabilizeIT stabilizes shaky footage including zoom and rotation: it keeps slow, intended camera moves and removes fast shake.

Filtering → Vapoursynth → Frame → Stabilize

StabilizeIT controls in Hybrid
StabilizeIT controls in Hybrid

What it does

Motion vectors are computed on a prefiltered copy of the clip (denoised, scaled down and back up). DepanAnalyse turns them into the global motion of each frame, and DepanStabilise smooths that motion with a low-pass filter (the vibration CutOff) and compensates the frames. Movement slower than the cutoff stays; faster movement is treated as shake. Unlike Stab it also corrects rotation and zoom.

Settings

Control Parameter Range / values Hybrid default Meaning
Divisor div 1.0 – 10.0 2.0 Downscale factor of the prefiltered analysis copy.
RG mode rgMode 0 – 24 4 RemoveGrain mode used twice in the prefilter.
Zoom (init/max) initZoom / zoomMax 1.0 – 10.0 each 1.0 / 1.0 Initial zoom, and largest additional zoom used to hide the borders.
Rotation (max) rotMax 0 – 180° 10 Largest rotation correction.
PAR pixelAspect 0.1 – 10.0 1.0 Pixel aspect ratio for analysis and compensation; not read from the clip.
SCD 1/2 thSCD1 / thSCD2 1 – 16320 / 1 – 255 800 / 150 Scene change thresholds of the motion analysis (block SAD limit / number of changed blocks).
Method stabMethod 0, 1 1 Stabilization method: 0 = inertial, 1 = average.
CutOff cutOff 0.01 – 1.0 Hz 0.33 Vibration frequency cutoff; slower movement is kept.
Error anaError 0 – 100 30 Largest mean motion difference the analysis accepts.
Tools: MV – mvutensils, mv – MVTools implementation.
Tools: RG – zsmooth, neo_smo – RemoveGrain implementation.

Example

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

# stabilizing using StabilizeIT
clip = fromDoom9.StabilizeIT(clip, tools={'mv': 'mvutensils', 'rg': 'zsmooth'})

How Hybrid calls it

  • StabilizeIT works on 8–16-bit integer YUV; width and height must be multiples of 4. Other formats are converted first.
  • Options are only written when they differ from the defaults; Hybrid's defaults are the script's defaults.
  • Prefilter: RemoveGrain, Bilinear down by Divisor, RemoveGrain, Bilinear back up; motion search with 8×8 blocks without overlap.
  • The scene change thresholds are not scaled by Hybrid; MVTools handles the bit depth.
  • Frame count and frame rate do not change.

Background

Origin

StabilizeIT is a VapourSynth port of VS_Fan's AviSynth function of the same name from the doom9 forum. It needs a RemoveGrain implementation and MVTools with the DePan functions (or mvutensils).

Sources