Vapoursynth MCDegrainSharp

From wiki.selur.net
Revision as of 09:51, 16 November 2026 by Selur (talk | contribs) (Update to current Hybrid behaviour; code as <pre> (via update-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

MCDegrainSharp is a motion-compensated denoiser based on Didée's MCDegrain: it averages along motion vectors and leans toward a slightly sharpened picture where the motion match is good and toward a slightly blurred one where it is bad.

Filtering → Vapoursynth → DeGrain

MCDegrainSharp controls in Hybrid
MCDegrainSharp controls in Hybrid

What it does

Motion vectors are searched (optionally on a blurred copy) for 1–3 frames on each side, and MVTools Degrain averages along them. The clip that Degrain renders from is slightly sharpened (Strength (sharp)), and the base clip is slightly blurred (Strength (blur)), so well-matched areas get a little crisper and badly matched areas a little softer.

Settings

Control Parameter Range / values Hybrid default Meaning
Strength frames 1 – 3 2 Frames on each side used for degraining.
Strength (blur) bblur 0 – 1.58 0.30 Blur of the base clip in badly matched areas.
Strength (sharp) csharp 0 – 1 0.30 Sharpening of the clip used to render the degrain, applied where the match is good.
Threshold (SAD) thsad 1 – 10000 400 Degrain SAD threshold: low values denoise unevenly, high values cause ghosting.
Plane plane luma, chroma U, chroma V, chroma both, all all Planes that are degrained.
Motion Search bsrch on/off on Search the motion on the blurred clip.
Tools: MV tools mvutensils, mv, mvgpu mvutensils (mvgpu with a discrete GPU on R82) Motion vector implementation.
Tools: Expr / TCanny tools akarin, cranexpr, std / tcanny akarin / tcanny Expression evaluator and blur.

Example

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

# removing grain using MCDegrain
clip = degrain.mcdegrainsharp(clip, tools={'mv': 'mvutensils', 'expr': 'akarin', 'tcanny': 'tcanny'})

How Hybrid calls it

  • MCDegrainSharp works on 8–16-bit integer YUV and gray clips.
  • The block size is 16 for widths above 960, otherwise 8.
  • All values are only written when they differ from the defaults; the Tools choice is always written.
  • MCDegrainSharp also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The script

The function is based on a VapourSynth port of Didée's MCDegrain (a GitHub gist by 4re); blur and sharpening use TCanny's Gaussian blur.

Sources