Posts: 25
Threads: 7
Joined: Mar 2026
Hello I have been given a relatively decent scan of a movie and they have asked me to removed all dirt and lines and stabalize it because it constantly shakes. Any ideas?
Here is a sample: https://mega.nz/file/1M5hxJaS#1tpI7kxh9V...iyiOFSwfws
Posts: 13.399
Threads: 78
Joined: May 2017
First ideas watched the clip one time:
a. Stab should work fine for the shakiness
b. multiple DeScratch with Mode Y high should help with the vertical line scratches
Not sure about the 'light flickering' may be SmallDeflicker or Deflicker,...
will look at it and report back.
Cu Selur
Ps.: Since you will probably need multiple instances of some of the filters, I would recommend to use the latest dev and either the "Filter Queue" or the "Node Editor" control and set Preview to "orginal|filtered|diff".
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 13.399
Threads: 78
Joined: May 2017
- add Tweak with Saturation = 0 (to be sure there is no unwanted chroma noise)
# adjusting color using Tweak
clip = color.Tweak(clip, hue=0.00, sat=0.00, cont=1.00, coring=True)
- To tackle the moving vertical luma bands I added a new filter VerticalBandDeflicker .
So, for stabilization try Deflicker, VerticalBandDeflicker, Stab with 'fix false positives' and 'Fill borders' enabled (move Stab behind VerticalBandDeflicker under FilterControl).
- To tackle the vertical scratches that are only about 1–2 levels brighter or darker (8-bit scale) and 4–6 px wide. That’s weaker than the film grain (which why Descratch wouldn't pick it up), I added a new filter named DescratchHighPass.
Next is denoising and additional scratch removal.
After a lot of tweaking I would recommend to try:
# Imports
import sys
import os
import vapoursynth as vs
# using Vapoursynth R82
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/libvs_placebo.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvutensilsvk.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/Deflicker.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/descratch.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/AvsInpaint/AvsInPaint.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/Neo-FFT/neo-fft.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/vszip/vszip.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/scenechange.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvutensils/mvutensils.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/cranexpr/cranexpr.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/libbestsource.dll")
# Import scripts
import nnedi3_resample
import smdegrain
import artifacts
import stabilize
import color
import validate
# Source: 'C:\Users\Selur\Desktop\ENA BOTSALO STH LIMNH Test Scene.mov'
# clip current meta; color space: YUV444P12, bit depth: 12, resolution: 1920x1080, fps: 25, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Source)
# Loading 'C:\Users\Selur\Desktop\ENA BOTSALO STH LIMNH Test Scene.mov' using BestSource
clip = core.bs.VideoSource(source="C:/Users/Selur/Desktop/ENA BOTSALO STH LIMNH Test Scene.mov", cachepath="J:/tmp/ENA BOTSALO STH LIMNH Test Scene_bestSource", track=0)
frame = clip.get_frame(0)
# setting color matrix to 709.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
# setting color transfer (vs.TRANSFER_BT709), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
# setting color primaries info (to vs.PRIMARIES_BT709), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
# setting color range to TV (limited) range.
prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the pixel aspect ratio is set to 1:1
clip = core.std.SetFrameProps(clip=clip, _SARNum=1, _SARDen=1)
# making sure the detected scan type is set (detected: progressive)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
# adjusting color using Tweak
clip = color.Tweak(clip, hue=0.00, sat=9.00, cont=1.00, coring=True)
# stabilizing using Stab
clip = stabilize.Stab(clip, mirror=0, fixfalpos=True, fillborder=1)
# scratch removal using DescratchHighPass
clip = artifacts.DescratchHighPass(clip, passes=[(4, 5, 3), (4, 7, 3)], limit=20.0)
# stabilizing mean luma using Deflicker
clip = core.deflicker.Deflicker(clip)
# removing vertical luma bands using VerticalBandDeflicker
clip = stabilize.VerticalBandDeflicker(clip, width=1920, maxwidth=600)
# removing grain using SMDegrain
clip = smdegrain.SMDegrain(clip, tr=3, RefineMotion=1, interlaced=False, dct=1)
# adjusting color space from YUV444P12 to YUV444P16 for vsGLSLFilmGrain
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16)
# Adding grain using GLSL AddGrain
with open("F:/Hybrid/64bit/vsfilters/GLSL/parameterized/filmgrain.glsl") as glslf:
glsl = glslf.read()
glsl = glsl.replace('#define INTENSITY 0.05', '#define INTENSITY 0.05')
clip = core.placebo.Shader(clip, shader_s=glsl, width=clip.width, height=clip.height, matrix=2)
# adjusting output color from YUV444P16 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, dither_type="error_diffusion")
# set output frame rate to 25fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# set output pixel aspect ratio to 1:1
clip = core.std.SetFrameProps(clip=clip, _SARNum=1, _SARDen=1)
# output
clip.set_output()
# clip current meta; color space: YUV420P10, bit depth: 10, resolution: 1920x1080, fps: 25, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
# script was created by Hybrid 2026.11.20.1
This is not perfect, but I suspect anything further would require manual setting adjustments on a per-scene basis. (i.e. when a scratch is directly after a scene change; some noise at the far right side of the image,...)
=> uploaded a new dev (Hybrid_dev_2026.11.20-225230) which comes with VerticalBandDeflicker and DescratchHighPass.
Cu Selur
Ps.: I assumed you wan to keep the film grain.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Posts: 25
Threads: 7
Joined: Mar 2026
Thank you so much it worked very well!
|