Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- 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 plugins
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/akarin.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
- # Import scripts
- import SpotLess
- import validate
- # Source: 'C:\Users\Selur\Desktop\Doraemon (1979) - 1144 (CS298 1440x1080 MPEG2-TS)_1.ts'
- # Current color space: YUV420P8, bit depth: 8, resolution: 1440x1080, frame rate: 29.97fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: mpeg-2
- # Loading 'C:\Users\Selur\Desktop\Doraemon (1979) - 1144 (CS298 1440x1080 MPEG2-TS)_1.ts' using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/ts_72e02d208e015990b0aa04e6aa7ad43f_853323747.dgi") # 29.97 fps, scanorder: progressive
- frame = clip.get_frame(0)
- # setting color matrix to 709.
- clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
- # 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_BT709), if it is not set.
- if validate.primariesIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
- # 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: progressive)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- clip = core.std.Crop(clip, left=186, right=186, top=6, bottom=4) # cropping to 1068x1070
- clip = core.fmtc.resample(clip=clip, w=640, h=640, kernel="cubic", interlaced=False, interlacedd=False) # resizing for 'Gimmick' (vsSpotLess)
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip, rec=True, pel=1, smoother="zsmooth")
- # removing flickering using ReduceFlicker
- clip = core.rdfl.ReduceFlicker(clip, strength=3, aggressive=1)
- # adjusting color space from YUV420P16 to RGBH for vsBasicVSRPPFilter
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_in_s="limited", range_s="full")
- # Quality enhancement using BasicVSR++
- from vsbasicvsrpp import basicvsrpp as BasicVSRPP
- clip = BasicVSRPP(clip, model=4)
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, dither_type="error_diffusion")
- # Resizing using 10 - bicubic spline
- clip = core.fmtc.resample(clip, kernel="spline16", w=1358, h=1020, interlaced=False, interlacedd=False) # resolution 1358x1020
- # adjusting output color from RGBS to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_in_s="full", range_s="limited") # additional resize to match target color sampling
- # set output frame rate to 29.97fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
- # output
- clip.set_output()
- # script was created by Hybrid 2026.04.15.1
Advertisement
Add Comment
Please, Sign In to add comment