Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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/znedi3.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/vszip/vszip.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/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/akarin/libakarin.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/cas.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/AutoAdjust.dll")
- 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/LSMASHSource.dll")
- # Import scripts
- import edi_rpow2
- import fromDoom9
- import killerspots
- import SpotLess
- import sharpen
- import validate
- # Source: 'G:\clips\comets tracking artifacts\the-letter_1929.mp4'
- # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 640x480, fps: 23.976, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true (Source)
- # Loading 'G:\clips\comets tracking artifacts\the-letter_1929.mp4' using LWLibavSource
- clip = core.lsmas.LWLibavSource(source="G:/clips/comets tracking artifacts/the-letter_1929.mp4", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
- frame = clip.get_frame(0)
- # setting color matrix to 470bg.
- clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
- # setting color transfer (vs.TRANSFER_BT601), if it is not set.
- if validate.transferIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
- # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
- if validate.primariesIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
- # 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 23.976fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
- # 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 space from YUV420P8 to YUV444P16 for vsGLSLSaturation
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16)
- # adjusting saturation using GSLS bSat
- with open("F:/Hybrid/64bit/vsfilters/GLSL/parameterized/bSat.hook.glsl") as glslf:
- glsl = glslf.read()
- glsl = glsl.replace('#define SatFactor 2.43', '#define SatFactor 0')
- clip = core.placebo.Shader(clip, shader_s=glsl, width=clip.width, height=clip.height)
- # adjusting levels, gamma, saturation and white balance using AutoAdjust
- clip = core.autoadjust.AutoAdjust(clip, auto_gain=True, gain_mode=1, chroma_process=0, auto_balance=True, high_quality=True)
- # contrast sharpening using CAS
- clip = core.cas.CAS(clip, planes=[0])
- # adjusting color space from YUV444P16 to YUV444P8 for vsDeScratch
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, dither_type="error_diffusion")
- # scratch removal using DeScratch
- clip = core.descratch.DeScratch(clip, asym=30, mindif=10, modey=3, minlen=80, maxgap=2)
- # sharpening using DetailSharpen
- clip = sharpen.DetailSharpen(clip, power=2.000, tools={'expr': 'akarin', 'median': 'zsmooth'})
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip, chroma=False, radT=3, asearch=5, truemotion=False, rec=True, fasthbd=True, pel=1, mStart=True, mEnd=True, tools={'mv': 'mvutensils', 'expr': 'akarin', 'tmedian': 'zsmooth', 'ttempsmooth': 'zsmooth', 'boxblur': 'vszip', 'hysteresis': 'hysteresis'})
- # spot/dirt removal using KillerSpots
- clip = killerspots.KillerSpots(clip, tools={'mv': 'mvutensils', 'rg': 'zsmooth', 'removedirt': 'removedirt'})
- # VHS denoising with motion-compensation
- clip = fromDoom9.VHSClean(clip, blur_sharp=False, tools={'mv': 'mvgpu', 'expr': 'akarin', 'boxblur': 'vszip'})
- # resizing using ZNEDI3
- # current: 640x480 target: 1920x1440
- clip = edi_rpow2.nnedi3_rpow2(clip, rfactor=4, tools={'nnedi3': 'znedi3'}) # 2560x1920
- # resizing 2560x1920 to 1920x1440
- clip = core.fmtc.resample(clip, w=1920, h=1440, kernel="spline64", interlaced=False, interlacedd=False) # before YUV444P8 after YUV444P16
- # 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 23.976fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
- # 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: 1920x1440, fps: 23.976, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
- # script was created by Hybrid 2026.11.10.1
Advertisement
Add Comment
Please, Sign In to add comment