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 R79
- # getting Vapoursynth core
- core = vs.core
- # 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/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/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/vszip/vszip.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/tivtc.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/composite.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
- # Import scripts
- import dehalo
- import qtgmc
- import nnedi3_resample
- import smdegrain
- import SpotLess
- import color
- import validate
- # Source: 'C:\Users\Selur\Desktop\Communion- Side One unprocessed sample.avi'
- # clip current meta; color space: YUV422P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: field-shifted, full height: true (Source)
- # Loading 'C:\Users\Selur\Desktop\Communion- Side One unprocessed sample.avi' using LWLibavSource
- clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Communion- Side One unprocessed sample.avi", format="YUV422P8", 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 29.97fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
- # making sure the detected scan type is set (detected: field-shifted)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
- # restoration using Composite
- clip = core.composite.Restore(clip, standard="ntsc")
- # Field matching using TFM
- clip = core.tivtc.TFM(clip)
- # Making sure content is perceived as frame based
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- # adjusting dynamic luma range usingAutoGain
- clip = color.AutoGain(clip, tools={'expr': 'akarin', 'planestats': 'vszip', 'scd': 'std'})
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip, radT=2, asearch=4, pel=1, mStart=True, mEnd=True, tools={'mv': 'mvutensils', 'expr': 'akarin', 'tmedian': 'zsmooth', 'ttempsmooth': 'zsmooth', 'boxblur': 'std', 'hysteresis': 'hysteresis'})
- clip = core.std.Crop(clip, left=0, right=12, top=102, bottom=108) # cropping to 708x270
- # removing grain using SMDegrain
- clip = smdegrain.SMDegrain(clip, tr=3, thSAD=600, thSADC=356, RefineMotion=False, contrasharp=50, interlaced=False, tools={'mv': 'mvutensils', 'expr': 'akarin', 'nnedi3': 'znedi3', 'dfttest': 'dfttest', 'nlmeans': 'nlm_ispc', 'bm3d': 'bm3d', 'rg': 'zsmooth', 'median': 'zsmooth', 'boxblur': 'std', 'scd': 'std'})
- clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=2) # add borders to archive mod 4 (vsQTGMCFilter) - 708x272
- # Denoising using QTGMC
- clip = qtgmc.QTGMC(clip, Preset="Fast", InputType=2, TR2=1, TFF=False, SourceMatch=0, Lossless=0, tools={'mv': 'mvutensils', 'expr': 'akarin', 'nnedi3': 'znedi3', 'eedi3': 'vszip', 'dfttest': 'dfttest', 'nlmeans': 'nlm_ispc', 'bm3d': 'bm3d', 'rg': 'zsmooth', 'median': 'zsmooth', 'fft3d': 'neo_fft3d', 'grain': 'noise'})
- clip = core.std.Crop(clip=clip, left=0, right=0, top=0, bottom=2) # removing added borders from mod requirement (vsQTGMCFilter) - 708x270
- # applying dehalo using YAHR
- for i in range(0,3):
- clip = dehalo.YAHR(clip, depth=24, tools={'expr': 'akarin', 'warp': 'warp', 'rg': 'zsmooth', 'median': 'zsmooth'})
- # 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 29.97fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
- # output
- clip.set_output()
- # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 708x270, fps: 29.97, 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.10.02.1
Advertisement
Add Comment
Please, Sign In to add comment