Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- 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")
- # loading plugins
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/VInverse/vinverse_vs.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/fmtconv.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/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 edi_rpow2
- import vs_deepdeinterlace
- import qtgmc
- import validate
- # Source: 'C:\Users\Selur\Desktop\outro.mkv'
- # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: top field first, full height: true (Source)
- # Loading 'C:\Users\Selur\Desktop\outro.mkv' using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mkv_2a601c9176f4fc6ae8cf25e52bec66c0_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
- # Deinterlacing using QTGMC
- clipEdiExt = clip
- # adjusting color space from YUV420P8 to RGBS for vsDDD
- clipEdiExt = core.resize.Bicubic(clip=clipEdiExt, format=vs.RGBS, matrix_in_s="470bg", range_in_s="limited", range_s="full")
- clipEdiExt = vs_deepdeinterlace.DDD(clipEdiExt, tff=True, fp16=True, device="cuda")
- # Making sure content is preceived as frame based
- clipEdiExt = core.std.SetFrameProps(clip=clipEdiExt, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- clipEdiExt = core.resize.Bicubic(clip=clipEdiExt, format=vs.YUV420P8, matrix_s="470bg", range_in_s="full", range_s="limited", dither_type="error_diffusion")
- clip = qtgmc.QTGMC(Input=clip, Preset="Slower", InputType=0, TFF=True, TR2=1, SourceMatch=0, Lossless=0, opencl=True, EdiExt=clipEdiExt) # 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
- clip = core.vinverse.vinverse(clip)
- # removing flickering using ReduceFlicker
- clip = core.rdfl.ReduceFlicker(clip, strength=3, aggressive=1)
- # resizing using NNEDI3CL
- # current: 720x480 target: 1280x960
- clip = edi_rpow2.nnedi3cl_rpow2(clip, rfactor=2, nsize=3, nns=4) # 1440x960
- # resizing 1440x960 to 1280x960
- clip = core.fmtc.resample(clip, w=1280, h=960, kernel="spline64", interlaced=False, interlacedd=False) # before YUV420P8 after YUV420P16
- # adjusting output color from YUV420P16 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, dither_type="error_diffusion")
- # 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: 1280x960, fps: 59.94, 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.07.08.1
Advertisement
Add Comment
Please, Sign In to add comment