Vapoursynth Stab
Stab removes small camera shake (jitter) by measuring how far each frame is shifted against a temporally averaged reference and moving it back.
Filtering → Vapoursynth → Frame → Stabilize

What it does
Stab is a port of the AviSynth Stab/Stab3s idea based on DePan's global motion estimation and compensation. A temporally softened copy of the clip serves as the steady reference; the global shift of each frame against it is estimated and compensated. Stab corrects shifts (optionally zoom), not rotation – for rotation use StabilizeIT. Areas uncovered at the frame edges become black, are mirrored, or can be filled from the source and inpainted.
Requirements
- Luma expansion AutoAdjust: the AutoAdjust plugin.
- Fix false positives: vszip.
- Fill borders: AvsInpaint and akarin.
Settings
| Control | Parameter | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Shift (max X/Y) | dxmax / dymax | 0 – 32768 | 8 / 8 | Largest horizontal / vertical shift searched, in pixels. With both at 0 the filter is skipped. |
| Mirror (top, bottom, left, right) | mirror | four on/off boxes | all off | Which uncovered borders are filled with mirrored edge pixels instead of black; any combination of sides. Hybrid sums the ticked sides into the mirror value (top 1, bottom 2, left 4, right 8). Disabled while Fill borders is on. |
| Soften radius | ts | 1 – 7 | 7 | Frames before and after that are averaged into the reference. |
| Max. zoom | zoom | 1.0 – 10.0 | 1.0 | Largest zoom that is estimated; 1.0 = no zoom estimation. |
| PAR (W:H) | pixaspect | 0 – 999999 each | 0 / 0 | Pixel aspect ratio; 0 in either field = taken from the clip (1.0 if the clip has none). Only matters with zoom or non-square pixels. |
| Luma expansion | luma_exp | off, TV to PC levels, AutoAdjust | off | Contrast stretch of the copy the motion is measured on; the output is not changed. |
| Fix false positives | fixfalpos | on/off | off | Frames whose result shows a black edge wider than 2 px (3 px with Fill borders) are replaced by the unstabilized frame. |
| Fill borders | fillborder | on/off | off | The uncovered area is taken from the source and inpainted (Stab3s FillBorder=1); YUV only, several times slower. |
| Tools: MV | – | mvutensils, mv | – | MVTools implementation (DePan functions). |
| Tools: RG / TemporalSoften / SCD | – | zsmooth, neo_smo / zsmooth, focus2 / scd, misc, std, mv | – | Repair, temporal soften and scene change detection. |
| Tools: PlaneStats | – | vszip | – | Used by Fix false positives. |
| Tools: Expr / Hysteresis / FFT3D | – | akarin, cranexpr / hysteresis, misc / neo_fft | – | Only used with Fill borders. |
Example
Default settings on a 10-bit YUV 4:2:0 source (640x356):
# stabilizing using Stab
clip = stabilize.Stab(clip, mirror=0, tools={'mv': 'mvutensils', 'rg': 'zsmooth', 'temporalsoften': 'zsmooth', 'scd': 'scd', 'planestats': 'vszip', 'expr': 'akarin', 'hysteresis': 'hysteresis', 'fft3d': 'neo_fft'})
How Hybrid calls it
- Stab works on 8–16-bit integer YUV and gray clips; with Fill borders only YUV is accepted. Other formats are converted first.
- The mirror value is always written (0 when no side is ticked; the script's own default would be 5); the other options only when they differ from the defaults.
- The TV to PC levels expansion is scaled to the bit depth of the clip.
- Inside, the clip is temporally softened (radius Soften radius), repaired and interleaved with the source; the motion is estimated and compensated on that interleave.
- Fix false positives checks edge strips twice the shift limit wide for black.
- Frame count and frame rate do not change.
Background
Stab and Stab3s
Stab comes from a family of AviSynth stabilization scripts built on DePan. Stab3s added filling the uncovered borders (FillBorder), which Hybrid offers as Fill borders using InpaintDelogo. The mvutensils DePan functions are largely taken over unchanged from MVTools.
Sources
- VapoursynthScriptsInHybrid (the script collection Hybrid uses)
- vapoursynth-mvtools
- Hybrid's tooltips