Avisynth TemporalDegrain2

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

TemporalDegrain2 is ErazorTT's improved TemporalDegrain: a strong temporal degrainer with QTGMC-style motion estimation, two motion-compensated degrain stages, an optional motion-compensated post denoiser and a limited contra-sharpening. It tracks low-contrast detail better than the original.

Filtering → Avisynth → DeGrain

TemporalDegrain2 controls in Hybrid
TemporalDegrain2 controls in Hybrid

What it does

  1. A blurred search clip is built and the motion is searched on it.
  2. Stage 1: MDegrain, limited to the change an FFT3D "limit" clip would make.
  3. Stage 2: a second MDegrain.
  4. Optionally a motion-compensated post denoiser (HQDn3D, Undot, FFT3D, DFTTest or NLMeansCL) and a contra-sharpening.

Most thresholds follow GrainLevel unless they are set by hand.

Typical use: strong grain on footage where simpler denoisers fail. The filter is slow. A Radius above about fps/8 rarely helps.

Requirements

CPU. FFT3DGPU (DirectX GPU) and NLMeansCL (OpenCL) are optional and only needed when chosen.

Settings

DeGrain

Control Parameter Range / values Hybrid default Meaning
Radius degrainTR 0–25 1 Frames on each side for the degrain stages. 0 switches MDegrain off; SAD, SCD and DCT then have no effect.
Plane degrainPlane luma, chroma, luma and chroma luma and chroma Planes that are degrained.
GrainLevel grainLevel −2–3 2 Noise level of the source. Sets the automatic SAD, SCD, limit and search clip values.
SAD1 / SAD2 ppSAD1 / ppSAD2 2–64 11 / 7 Per-pixel SAD thresholds of the two stages.
SCD1 / SCD2 ppSCD1 / thSCD2 1–64000 5 / 128 Scene change thresholds.
DCT DCT 0–10 0 Block comparison mode. 0 is spatial; 5 mixes spatial and DCT and helps with fades.
Gauss gaussParam 1–100 3 Parameter of the spatial blur of the search clip.
Limit Sigma limitSigma 0–40 off Sigma of the FFT3D limit clip. Only written when the check box is ticked; otherwise the script picks it from the grain level.
Limit Block size limitBlksz 2–64 off Block size of the limit clip. Only written when ticked.
Limit FFT limitFFT CPU, GPU CPU Which FFT3D implementation builds the limit clip.
Sharpen extraSharp on/off off Stronger contra-sharpening.

Motion Estimation

Control Parameter Range / values Hybrid default Meaning
Me meAlg 0–7 (one time, nStep, logarithmic, exhaustive, hexagon, uneven multi hexagon, pure horizontal, pure vertical) hexagon Search algorithm.
Algo param meAlgPar 1–64 auto Search parameter. Only written when the check box is ticked.
Subpixel Method meSubpel 1, 2, 4 auto Sub-pixel accuracy. Only written when ticked.
Me block size meBlksz 4–64 auto Block size of the motion search. Only written when ticked.
True motion meTM on/off off Smoother motion field.

Post-processing FFT

Control Parameter Range / values Hybrid default Meaning
Post FFT postFFT HQDn3D, Undot, NeoFFT3D, FFT3DFilter, FFT3DGPU, NeoDFTTest, dfttest, NLMeansCL Undot Motion-compensated post denoiser.
Post TR postTR 0–5 1 Frames on each side (2 × TR + 1 in total) used by the post denoiser.
Post Sigma postSigma 0–40 1 Strength of the post denoiser. Not used by Undot and HQDn3D.
Post Dither postDither −40–1 1 Greater than 0: the post stage and contra-sharpening run at 16 bit and the result is dithered. 0: the bit depth of the clip is kept. Below 0: dfttest dither with that strength (absolute value).
Knl DeviceID devId 0–4 0 OpenCL device for NLMeansCL.
FFT Threads fftThreads 1–16 1 Threads for FFT3D, DFTTest and the limit stage.

Example

Default settings on a 10-bit YUV 4:2:0 source (no conversion is added):

TemporalDegrain2()

How Hybrid calls it

  • Hybrid loads the TemporalDegrain2 script, the neo-smo helpers, masktools2.dll, mvtools2.dll and, depending on the choices, hqdn3d, neo-fft3d, FFT3DFilter, FFT3dGPU, neo-dfttest, dfttest and KNLMeansCL.
  • The script is not interlace-aware; Hybrid handles interlaced input itself.
  • Only values that differ from the defaults are written. Plane is written when it is not luma and chroma. The ticked "manual" check boxes write their value.
  • Post FFT is translated to the script's numbering, so every entry calls the denoiser it names.
  • TemporalDegrain2 also offers the common options and can be added to the filter queue several times.

Background

TemporalDegrain2 v2.6.7 (2024) was updated by ErazorTT from Sagekilla's TemporalDegrain (v1.23), which goes back to an idea of Didée. Compared with the original it uses QTGMC-style motion estimation, an optional motion-compensated post filter and a grain-level based automatic setup. The script header suggests: Radius 1 and GrainLevel 2 for most material; a Post FFT with Post Sigma 0–1 for more denoising and a stronger filter with Post Sigma 1–2 for heavy grain.

See also: Vapoursynth TemporalDegrain2, TemporalDegrain

Sources