Vapoursynth RemoveGrain

From wiki.selur.net
Revision as of 20:51, 14 November 2026 by Selur (talk | contribs) (New filter page (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

RemoveGrain is a purely spatial 3×3 filter with 24 modes: clipping and median variants, line-sensitive clipping, blurs and simple field interpolators. On its own it is a light denoiser; it is mostly used as a building block in other filters.

Filtering → Vapoursynth → DeGrain

RemoveGrain controls in Hybrid
RemoveGrain controls in Hybrid

What it does

Each pixel is compared with its eight neighbors and replaced according to the mode, for example clipped to the range of its neighbors (modes 1–4), clipped in a line-preserving way (5–10), blurred (11, 12, 19, 20), or interpolated from the lines of the other field (13–16).

Settings

Control Parameter Range Hybrid default Meaning
Mode mode 1 – 24 16 Filter mode, applied to all planes; see the mode list in the tooltip.
Tools: RG tools zsmooth, neo_smo zsmooth Plugin that provides RemoveGrain.

Modes 13–16 interpolate one field from the other and are meant for interlaced material; for normal denoising choose one of the clipping or median modes.

Example

Default settings on a 10-bit YUV 4:2:0 source:

# removing grain using RemoveGrain
clip = core.zsmooth.RemoveGrain(clip, mode=16)

How Hybrid calls it

  • RemoveGrain works on 8–16-bit integer YUV.
  • The mode is always written and applies to all planes.
  • The filter is not interlace-aware: interlaced clips are processed as separated fields.
  • RemoveGrain also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

zsmooth (RemoveGrain)

zsmooth's RemoveGrain supports modes 0–24 (0 copies the plane), one mode per plane, 8–16-bit integer and 16/32-bit float clips, and mirrors the frame edges. neo_smo offers the same function with the same arguments.

vs-removegrain (rgvs)

The old VapourSynth RemoveGrain plugin documents the modes in detail; it marked modes 4, 11, 12, 19 and 20 as replaceable by std.Median and std.Convolution and copied the edge rows and columns instead of mirroring them.

Sources