Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import vapoursynth as vs
- # getting Vapoursynth core
- import ctypes
- import sys
- import os
- core = vs.core
- # 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/DeinterlaceFilter/TIVTC/libtivtc.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/Support/EEDI3m_opencl.dll")# DeinterlaceFilter-Selector
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
- # Import scripts
- import edi_rpow2
- import havsfunc
- import validate
- # Source: 'C:\Users\Selur\Desktop\S01E02.m2v'
- # Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: telecine, yuv luminance scale: limited, matrix: 470bg
- # Loading C:\Users\Selur\Desktop\S01E02.m2v using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/m2v_99a799e941bc5bc853296548b02b2beb_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: telecine
- frame = clip.get_frame(0)
- # Setting detected color matrix (470bg).
- clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
- # setting color transfer (170), if it is not set.
- if validate.transferIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
- # setting color primaries info (to 470), if it is not set.
- if validate.primariesIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
- # setting color range to TV (limited) range.
- clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
- # 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: telecine)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=2) # tff
- clip2clip = clip
- clip2clip = havsfunc.QTGMC(Input=clip2clip, Preset="fast", opencl=True, TFF=False, FPSDivisor=2)
- # Deinterlacing using TIVTC
- clip = core.tivtc.TFM(clip=clip, clip2=clip2clip)
- clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976
- # Making sure content is preceived as frame based
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
- clip = core.std.CropRel(clip=clip, left=8, right=8, top=0, bottom=0)# cropping to 704x480
- # adjusting color space from YUV420P8 to RGBH for vsBasicVSRPPFilter
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
- # Quality enhancement using BasicVSR++
- from vsbasicvsrpp import basicvsrpp as BasicVSRPP
- clip = BasicVSRPP(clip=clip, model=4)
- # adjusting color space from RGBH to RGB48 for NNEDI3(CL)
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB48, range_s="limited")
- # resizing using NNEDI3CL
- # current: 704x480 target: 1408x1080 -> pow: 4
- clip = edi_rpow2.nnedi3cl_rpow2(clip=clip, rfactor=4, nsize=3, nns=4) # 2816x1920
- # adjusting resizing
- clip = core.fmtc.resample(clip=clip, w=1408, h=1080, kernel="spline64", interlaced=False, interlacedd=False)# before RGB48 after RGB48
- # adjusting output color from: RGB48 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
- # set output frame rate to 23.976fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
- # output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement