Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import vapoursynth as vs
- import os
- import ctypes
- # Loading Support Files
- Dllref = ctypes.windll.LoadLibrary("i:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
- import sys
- # getting Vapoursynth core
- core = vs.core
- # Import scripts folder
- scriptPath = 'i:/Hybrid/64bit/vsscripts'
- sys.path.insert(0, os.path.abspath(scriptPath))
- import site
- # Import libraries for onnxruntime
- path = site.getsitepackages()[0]+'/onnxruntime_dlls/'
- ctypes.windll.kernel32.SetDllDirectoryW(path)
- # Loading Plugins
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
- # Import scripts
- import havsfunc
- # source: 'C:\Users\Selur\Desktop\Donna-Summer-2-tff.mp4'
- # current color space: YUV422P10, bit depth: 10, resolution: 760x488, fps: 29.97, color matrix: 709, yuv luminance scale: limited, scanorder: top field first
- # Loading C:\Users\Selur\Desktop\Donna-Summer-2-tff.mp4 using LibavSMASHSource
- clip = core.lsmas.LibavSMASHSource(source="C:/Users/Selur/Desktop/Donna-Summer-2-tff.mp4")
- # Setting color matrix to 709.
- clip = core.std.SetFrameProps(clip, _Matrix=1)
- clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=1)
- clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
- # Setting color range to TV (limited) range.
- clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
- # making sure frame rate is set to 29.970
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2)
- # setting field order to what QTGMC should assume (top field first)
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2)
- # Deinterlacing using QTGMC
- clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 59.94
- # make sure content is preceived as frame based
- clip = core.std.SetFieldBased(clip, 0)
- # cropping the video to 742x482
- clip = core.std.CropRel(clip=clip, left=10, right=8, top=4, bottom=2)
- from vsrealesrgan import RealESRGAN
- clip = core.std.AddBorders(clip=clip, left=0, right=2, top=0, bottom=2) # add borders to archive mod 4 (VsRealESRGAN) - 744x484
- # adjusting color space from YUV422P10 to RGBS for VsRealESRGAN
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", range_s="limited")
- # resizing using RealESRGAN
- clip = RealESRGAN(clip=clip, model=0, provider=1, device_id=0) # 1488x968
- # resizing 1488x968 to 884x488
- clip = core.std.CropRel(clip=clip, left=0, right=4, top=0, bottom=4) # removing borders (VsRealESRGAN) - 1484x964
- # adjusting resizing
- clip = core.fmtc.resample(clip=clip, w=884, h=488, kernel="lanczos", interlaced=False, interlacedd=False)
- # adjusting output color from: RGBS to YUV422P10 for x265Model
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, matrix_s="709", range_s="limited", dither_type="none")
- # set output frame rate to 59.94fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
- # Output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment