Vapoursynth VHSClean

From wiki.selur.net
Jump to navigation Jump to search

VHSClean is a strong, motion-compensated denoiser for noisy VHS captures. It aims at a thorough cleanup that keeps more fine detail than typical strong denoisers.

Filtering → Vapoursynth → Artifacts

VHSClean controls in Hybrid
VHSClean controls in Hybrid

What it does

VHSClean works in four stages: a soft degrain pass with two reference frames on each side, re-injection of that result over the source (which brings detail back), a strong degrain pass on large blocks with six reference frames on each side, and a recovery step. The recovery step uses a difference mask to bring back fast moving objects, such as water drops, that the strong pass smeared, on all planes.

Settings

Control Parameter Range / values Hybrid default Meaning
Threshold ths 1 – 500 100 Denoising strength (SAD threshold); the other thresholds follow from it (soft chroma 2×, strong luma 4×, strong chroma 8×). Higher is stronger and loses more detail.
BlurSharp blur_sharp on/off on The strong stage uses a sharpened copy for compensation and a blurred copy for motion search and as the degrain base; off uses the re-injected clip for both.
Search searchparam 1 – 32 2 Motion search range of every motion analysis; larger values follow faster motion (the author recommends 8 or more for UHD); ignored by mvgpu.
Blur blur_amount 0.1 – 1.0 0.6 Blur and sharpen amount of the strong stage (blurred search copy and sharpened compensation copy).
Tools: MV – mvgpu, mvutensils, mv mvgpu with a discrete GPU, else mvutensils Motion vector implementation; mvgpu ignores the fixed search settings.
Tools: Expr – akarin, cranexpr, std akarin Expression implementation.
Tools: BoxBlur – vszip, std vszip Box blur implementation (recovery mask).

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# VHS denoising with motion-compensation
clip = fromDoom9.VHSClean(clip, searchparam=2, blur_amount=0.60, tools={'mv': 'mvutensils', 'expr': 'akarin', 'boxblur': 'vszip'})

How Hybrid calls it

  • VHSClean works on any YUV format, all bit depths including float; RGB is converted to YUV first.
  • Threshold and BlurSharp are only written when they differ from the defaults, which equal the script's. Search, Blur and the Tools choice are always written.
  • Threshold is not scaled: the MV plugins scale SAD thresholds to the bit depth. The script scales its fixed recovery mask threshold itself.
  • The script needs progressive material; interlaced captures should be deinterlaced first.
  • VHSClean also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The original

VHSClean is a port of AVIL's AviSynth script from the Doom9 thread "Strong VHS cleaning". The author tested it on 4:2:2 VHS material, recommends a good bob deinterlacer before it, and suggests a larger search range (8 or more) for UHD; the port keeps the search range fixed at 2. In the original the blur grows slightly with the frame size and fast objects are restored in luma only; the port uses a fixed blur and restores all planes. It is slow: twelve vector searches on 64-pixel blocks plus four on 16×8 blocks per frame.

Sources