Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import vapoursynth as vs
- # getting Vapoursynth core
- import logging
- import ctypes
- import sys
- import os
- 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/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.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/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/RemoveDirt/libremovedirtvs.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/SourceFilter/BestSource/BestSource.dll")
- # defining beforeDeCross-function - START
- def beforeDeCross(clip):
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/vcm.dll")
- clip = core.vcm.DeJitter(clip, jmax=10, thresh=0.03, wsyn=4)
- return [clip]
- # defining beforeDeCross-function - END
- # Import scripts
- import linedarken
- import qtgmc
- import nnedi3_resample
- import smdegrain
- import killerspots
- import SpotLess
- import validate
- # Source: 'G:\clips\drop outs - comets\test_20000.mov'
- # Current color space: YUV444P12, bit depth: 12, resolution: 760x488, frame rate: 29.97fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, format: prores
- # Loading 'G:\clips\drop outs - comets\test_20000.mov' using BestSource
- clip = core.bs.VideoSource(source="G:/clips/drop outs - comets/test_20000.mov", cachepath="J:/tmp/test_20000_bestSource", track=0, hwdevice="opencl")
- frame = clip.get_frame(0)
- # setting color matrix to 709.
- clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
- # 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.
- clip = core.std.SetFrameProps(clip=clip, _ColorRange=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] = beforeDeCross(clip)
- # clip current meta; color space: YUV444P12, bit depth: 12, resolution: 760x488, fps: 29.97, color matrix: 709, yuv luminance scale: limited, scanorder: progressive, full height: true
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip, rec=True, pel=1, smoother="zsmooth")
- # adjusting color space from YUV444P12 to YUV420P8 for vsKillerSpots
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, dither_type="error_diffusion")
- # spot/dirt removal using KillerSpots
- clip = killerspots.KillerSpots(clip, advanced=False)
- clip = core.std.Crop(clip, left=8, right=14, top=4, bottom=4) # cropping to 738x480
- # removing grain using SMDegrain
- clip = smdegrain.SMDegrain(clip, tr=3, thSAD=1200, contrasharp=50, interlaced=False, opencl=True, device=-1)
- clip = core.std.AddBorders(clip=clip, left=0, right=2, top=0, bottom=0) # add borders to archive mod 4 (vsQTGMCFilter) - 740x480
- # Denoising using QTGMC
- clip = qtgmc.QTGMC(clip, Preset="Fast", InputType=3, TR2=1, TFF=False, SourceMatch=0, Lossless=0, opencl=True)
- clip = core.std.Crop(clip=clip, left=0, right=2, top=0, bottom=0) # removing added borders from mod requirement (vsQTGMCFilter) - 738x480
- # line darkening using Toon
- clip = linedarken.Toon(clip, str=1.50)
- # adjusting resolution before resizing
- clip = core.fmtc.resample(clip, w=368, h=480, kernel="cubic", interlaced=False, interlacedd=False) # before YUV420P8 after YUV420P16
- from vsrealesrgan import realesrgan as RealESRGAN
- # adjusting color space from YUV420P16 to RGBS for vsRealESRGAN
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", range_in_s="limited", range_s="full", dither_type="error_diffusion")
- # resizing using RealESRGAN
- clip = RealESRGAN(clip, model=102, device_index=0) # 736x960
- # resizing 736x960 to 1280x710
- clip = core.fmtc.resample(clip, w=1280, h=710, kernel="spline64", interlaced=False, interlacedd=False)
- # 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.03.04.1
Advertisement
Add Comment
Please, Sign In to add comment