Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import ctypes
- import sys
- import os
- import vapoursynth as vs
- # using Vapoursynth R78
- # getting Vapoursynth core
- core = vs.core
- # Limit frame cache to 48449MB
- core.max_cache_size = 48449
- # Import scripts folder
- scriptPath = 'F:/Hybrid/64bit/vsscripts'
- sys.path.insert(0, os.path.abspath(scriptPath))
- # Loading Support Files
- Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
- # loading plugins
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/cas.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/hysteresis/hysteresis.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/dfttest2/dfttest2_nvrtc.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/bwdif.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/nnedi3vk/nnedi3vk.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/eedi3vk2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/addnoise.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/zsmooth/zsmooth.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/libbestsource.dll")
- # defining beforeYAHR-function - START
- def beforeYAHR(clip):
- clip = core.akarin.Expr(clip, expr=["x 200 > x 0.8 * 40 + x ?","", ""]) # Luma only
- return [clip]
- # defining beforeYAHR-function - END
- # defining beforeBlindDeHalo3-function - START
- def beforeBlindDeHalo3(clip):
- clip = dehalo.SecondOrderDehalo(clip)
- return [clip]
- # defining beforeBlindDeHalo3-function - END
- # Import scripts
- import sharpen
- import dehalo
- import edge
- import SpotLess
- import dfttest2
- import qtgmc
- import validate
- # Source: 'C:\Users\Selur\Desktop\Show_Clips_(7-9-2026)_sample.mov'
- # clip current meta; color space: YUV422P10, bit depth: 10, resolution: 720x486, fps: 29.97, color matrix: 170m, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: bottom field first, full height: true (Source)
- # Loading 'C:\Users\Selur\Desktop\Show_Clips_(7-9-2026)_sample.mov' using BestSource
- clip = core.bs.VideoSource(source="C:/Users/Selur/Desktop/Show_Clips_(7-9-2026)_sample.mov", cachepath="J:/tmp/Show_Clips_(7-9-2026)_sample_bestSource", track=0, hwdevice="opencl")
- frame = clip.get_frame(0)
- # setting color matrix to 170m.
- clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_ST170_M)
- # 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_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 29.97fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
- # making sure the detected scan type is set (detected: bottom field first)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_BOTTOM) # scan type: bottom field first
- # Deinterlacing using QTGMC
- clip = qtgmc.QTGMC(clip, Preset="Fast", TFF=False, opencl=True) # new fps: 59.94
- # Making sure content is perceived as frame based
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- # Spot removal using SpotLess + DeltaRestore
- clip = SpotLess.SpotDelta(clip, radT=3, rec=True, pel=1, dark2_brt=0.97, sharpen_it=False)
- # removing flickering using ReduceFlicker
- clip = core.rdfl.ReduceFlicker(clip, strength=3, aggressive=1)
- clip = core.std.Crop(clip, left=56, right=40, top=4, bottom=12) # cropping to 624x470
- # Fix bright and dark line artifacts near the border of an image using BalanceBorders
- clip = edge.bbmod(clip, cLeft=12, cTop=0, cRight=0, cBottom=0)
- # contrast sharpening using CAS
- clip = core.cas.CAS(clip, sharpness=0.700)
- # applying dehalo using DeHalo_alpha
- clip = dehalo.DeHalo_alpha(clip)
- [clip] = beforeYAHR(clip)
- # clip current meta; color space: YUV422P10, bit depth: 10, resolution: 624x470, fps: 59.94, color matrix: 170m, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true
- # applying dehalo using YAHR
- for i in range(0,5):
- clip = dehalo.YAHR(clip, depth=16)
- [clip] = beforeBlindDeHalo3(clip)
- # clip current meta; color space: YUV422P10, bit depth: 10, resolution: 624x470, fps: 59.94, color matrix: 170m, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true
- # adjusting output color from YUV422P10 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
- # set output frame rate to 59.94fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
- # output
- clip.set_output()
- # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 624x470, fps: 59.94, color matrix: 170m, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
- # script was created by Hybrid 2026.07.31.1
Advertisement
Add Comment
Please, Sign In to add comment