Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import logging
- import ctypes
- import sys
- import os
- import vapoursynth as vs
- # 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")
- # Force logging to std:err
- logging.StreamHandler(sys.stderr)
- # loading plugins
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/scenechange/scenechange.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/RIFE/librife.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vs-mlrt/vstrt.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.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/sneedif/libsneedif.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libeedi3vk.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/mvtools.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
- 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/fmtconv.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/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
- # Import scripts
- import misc
- import vs_temporalfix
- import qtgmc
- import SpotLess
- import sharpen
- import dehalo
- import validate
- # Source: 'C:\Users\Selur\Desktop\S01E01 - GTO - The Legend Begins.mkv'
- # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, color primaries: Unspecific, color transfer: BT.601, yuv luminance scale: limited, scanorder: top field first, full height: true (Source)
- # Loading 'C:\Users\Selur\Desktop\S01E01 - GTO - The Legend Begins.mkv' using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mkv_82ddc8a0a57ca25c024680bb71faa1df_853323747.dgi",fieldop=0) # 29.97 fps, scanorder: top field first
- 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: top field first)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
- # converting interlaced to half-height progressive for filtering (vsYAHR) (separate fields)
- clip = core.std.SeparateFields(clip, tff=True) # resolution 720x240
- clipEven = clip[::2]
- clipEven = core.std.SetFrameProps(clip=clipEven, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- clipOdd = clip[1::2]
- clipOdd = core.std.SetFrameProps(clip=clipOdd, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- # applying dehalo using YAHR
- clipEven = dehalo.YAHR(clipEven, depth=16)
- # applying dehalo using YAHR
- clipOdd = dehalo.YAHR(clipOdd, depth=16)
- # Spot removal using SpotLess
- clipEven = SpotLess.SpotLess(clipEven, radT=3, rec=True, pel=1)
- # Spot removal using SpotLess
- clipOdd = SpotLess.SpotLess(clipOdd, radT=3, rec=True, pel=1)
- # adjusting color space from YUV420P8 to RGBH for vsBasicVSRPPFilter
- clipEven = core.resize.Bicubic(clip=clipEven, format=vs.RGBH, matrix_in_s="470bg", range_in_s="limited", range_s="full")
- # Quality enhancement using BasicVSR++
- from vsbasicvsrpp import basicvsrpp as BasicVSRPP
- clipEven = BasicVSRPP(clipEven, model=4)
- # adjusting color space from YUV420P8 to RGBH for vsBasicVSRPPFilter
- clipOdd = core.resize.Bicubic(clip=clipOdd, format=vs.RGBH, matrix_in_s="470bg", range_in_s="limited", range_s="full")
- # Quality enhancement using BasicVSR++
- clipOdd = BasicVSRPP(clipOdd, model=4)
- # converting half-height progressive to interlacedbefore deinterlacing
- clip = core.std.Interleave([clipEven, clipOdd])
- clip = core.std.DoubleWeave(clip=clip, tff=False) # resolution: 720x480
- clip = core.std.SelectEvery(clip, 2, 0) # scan type: bottom field first
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
- # adjusting color space from RGBH to YUV444P16 for vsQTGMC
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_in_s="full", range_s="limited")
- # Deinterlacing using QTGMC
- clip = qtgmc.QTGMC(clip, Preset="Fast", TFF=True, opencl=True) # new fps: 59.94
- # Making sure content is preceived as frame based
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- # changing range from limited to full range for vsTemporalfix
- clip = core.resize.Bicubic(clip, format=vs.YUV444P16, range_in_s="limited", range_s="full")
- # setting color range to PC (full) range.
- prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
- clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_FULL})
- # adjusting color space from YUV444P16 to RGBH for vsTemporalfix
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_in_s="full", range_s="full")
- # stabilizing using Temporalfix (Torch)
- clip = vs_temporalfix.model(clip, backend="tensorrt", engine_folder="J:/TRT")
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_in_s="full", range_s="full")
- clip = misc.SCDetect(clip=clip,threshold=0.100)
- # adjusting color space from YUV444P16 to RGBS for vsRIFE
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_in_s="full", range_s="full")
- # adjusting frame count&rate with RIFE, target fps: 23.976fps
- clip = core.rife.RIFE(clip, model=58, fps_num=24000, fps_den=1001, sc=True) # new fps: 23.976
- # Resizing using 10 - bicubic spline
- clip = core.fmtc.resample(clip, kernel="spline16", w=656, h=480, interlaced=False, interlacedd=False) # resolution 656x480
- # adjusting output color from RGBS to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_in_s="full", range_s="full", dither_type="error_diffusion")
- # changing range from full to limited range for matching filter target luma scale
- clip = core.resize.Bicubic(clip, format=vs.YUV420P10,range_in_s="full", range_s="limited")
- # 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})
- # set output frame rate to 23.976fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
- # output
- clip.set_output()
- # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 656x480, fps: 23.976, color matrix: 470bg, color primaries: Unspecific, color transfer: BT.601, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
- # script was created by Hybrid 2026.07.05.1
Advertisement