Avisynth MDegrain
MDegrain is the motion-compensated temporal denoiser of the MVTools plugin. It removes grain and noise with little blurring of moving areas, but it is slow.
Filtering → Avisynth → DeGrain

What it does
For every block of the picture, motion to the previous and next 1–3 frames is estimated. These frames are shifted to match the current one and averaged with it. Blocks that fit well get a high weight; blocks that differ too much get none. Noise, which is random, averages out; the picture content, which is aligned by the motion, stays.
Typical use: grainy or noisy footage where a spatial filter would soften too much. Low SAD threshold values give patchy denoising, high values can cause ghosting.
Requirements
Windows, CPU only. mvtools2.dll is shipped with Hybrid.
Settings
| Control | Parameter | Range | Hybrid default | Meaning |
|---|---|---|---|---|
| Temporal depth | MDegrain1/2/3 | 1–3 | 3 | Number of frames used in each direction. |
| SAD threshold luma/chroma | thSAD / thSADC | 1–10000 | 400 / 400 | Blocks whose difference is above the threshold get zero weight. |
| Max change | limit | 1–255 | 255 | Maximum change per pixel; 255 means no limit. |
| Planes | plane | 0–4 | 4 | 0 luma, 1 U, 2 V, 3 both chromas, 4 all planes. |
| Motion analysis | ||||
| Analysis pel | pel | 1, 2, 4 | 2 | Pixel accuracy of the motion search: full, half or quarter pixel. |
| Analysis lambda | lambda | 1–10000 | 1000 | Weight of motion-field smoothness in the search. |
| Blocksize | blksize | 4, 8, 16, 32 | 8 | Size of the blocks the motion is estimated for. The overlap is half the block size, at most 4. |
Example
Default settings on a 10-bit YUV 4:2:0 source:
degainsource=last super = degainsource.MSuper(pel=2, sharp=2, planar=true) backward_vector_1 = super.MAnalyse(overlap=4,isb=true,delta=1,lambda=1000) forward_vector_1 = super.MAnalyse(overlap=4,isb=false,delta=1,lambda=1000) backward_vector_2 = super.MAnalyse(overlap=4,isb=true,delta=2,lambda=1000) forward_vector_2 = super.MAnalyse(overlap=4,isb=false,delta=2,lambda=1000) backward_vector_3 = super.MAnalyse(overlap=4,isb=true,delta=3,lambda=1000) forward_vector_3 = super.MAnalyse(overlap=4,isb=false,delta=3,lambda=1000) MDeGrain3(super, backward_vector_1, forward_vector_1, backward_vector_2, forward_vector_2, backward_vector_3, forward_vector_3)
How Hybrid calls it
- Hybrid loads mvtools2.dll, builds a super clip with
MSuper, runsMAnalysefor each frame distance up to Temporal depth, and then callsMDeGrain1,MDeGrain2orMDeGrain3. - SAD threshold, Planes and Max change are only written when they differ from the defaults. Blocksize is only written when it is not 8. Analysis pel is passed to
MSuper; the vectors are searched withisb=true(backward) andisb=false(forward). - Works on planar YUV 4:2:0, 4:2:2 and 4:4:4 at 8–16 bit integer. Gray, RGB and float clips are not supported; Hybrid converts the color space before the filter if needed.
- The filter is not interlace-aware.
- MDegrain also offers the common options and can be added to the filter queue several times.
Background
MVTools was written by Manao and Fizick; pinterf maintains the version used here (MVTools 2) with high bit depth support. MVTools 2 has no index parameter; the super clip carries the data instead. Other MVTools-based filters in Hybrid are SMDegrain, MCDegrainSharp and TemporalDegrain.
Sources
- MVTools (pinterf) documentation
- Hybrid's tooltips
- The AviSynth+ documentation does not cover MDegrain.