Vapoursynth RemoveDirt
RemoveDirt is a temporal cleaner for film dirt: specks and blotches that appear in a single frame. Motion detection keeps moving areas from being smeared by the cleaning.
Filtering → Vapoursynth → Artifacts

What it does
A strong temporal clean (the median of the previous, current and next frame) removes the dirt. At scene changes a forward or backward clean is picked instead, so frames of different scenes are not mixed. The motion detection then decides for each 8×8 block: static blocks get the cleaned version, moving blocks get a version repaired against the source. A final RemoveGrain pass smooths what is left. Fine detail and fast motion can get blurred.
Settings
| Control | Parameter | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Repair mode | repmode | 0 – 24 | 16 | Repair mode used to limit the cleaned frame against the source, for luma; both chroma planes use mode 1. |
| RemoveGrain mode | remgrainmode | 0 – 24 | 17 | Mode of the final RemoveGrain pass on luma; both chroma planes use mode 1. |
| Limit | limit | 0 – 255 | 10 | Noise level of the motion detection: pixel differences up to this value are ignored. Higher means fewer blocks count as motion, so more of the frame gets the temporal clean. |
| Tools: RG | – | zsmooth, neo_smo | zsmooth | RemoveGrain/Repair/Clense implementation. |
| Tools: RemoveDirt | – | removedirt | removedirt | RemoveDirt plugin. |
Example
Default settings on a 10-bit YUV 4:2:0 source:
# adjusting color space from YUV420P10 to YUV444P16 for vsRemoveDirt
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16)
# denoising using VsRemoveDirt
clip = removeDirt.RemoveDirt(clip, tools={'rg': 'zsmooth', 'removedirt': 'removedirt'})How Hybrid calls it
- RemoveDirt works on 8-bit and 16-bit YUV 4:2:0, 4:2:2 and 4:4:4; other formats (other bit depths, other subsamplings, float, RGB, gray) are converted first.
- Values are only written when they differ from the defaults; Hybrid's defaults equal the script's. The Tools choice is always written.
- Limit is not scaled: the plugin treats it on the 8-bit scale at every bit depth.
- The other motion detection values are fixed as in the classic script: 70 % motion blocks mark a scene change, block spreading distance 1, mode 2, and 12 noisy pixels make a motion block.
- RemoveDirt also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).
Background
The plugin and the script
RemoveDirt was written by Rainer Wittmann (kassandro) for AviSynth; Ferenc Pinter's port adds more color formats, 10 – 16 bit and, since version 1.0, VapourSynth support. The plugin provides the motion detection (RestoreMotionBlocks) and the scene change selection (SCSelect); the cleaning itself comes from RemoveGrain-type filters. The script follows the classic RemoveDirt function from the plugin's documentation (repair mode 16, final mode 17, noise 10).
Motion detection
A block counts as moving when more than the set number of its pixels differ by more than the noise level. If the share of moving blocks exceeds the scene change percentage, the whole frame uses the alternative clip. The author used noise values of 8 – 10 with 12 noisy pixels.
Sources
- RemoveDirt plugin (README and bundled documentation)
- zsmooth README
- VapoursynthScriptsInHybrid (the script collection Hybrid uses)
- Hybrid's tooltips