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/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/RemoveGrain/RemoveGrainVS.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/libmvtools.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 havsfunc
- import muvsfunc
- import validate
- # Source: 'C:\Users\Selur\Desktop\test.mkv'
- # Current color space: YUV420P8, bit depth: 8, resolution: 1216x684, frame rate: 30fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, format: AVC
- # Loading C:\Users\Selur\Desktop\test.mkv using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mkv_aaf47d044f0319abfb06280a337316d9_853323747.dgi")# 30 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.
- clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
- # making sure frame rate is set to 30fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30, fpsden=1)
- # making sure the detected scan type is set (detected: progressive)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
- # adjusting frame count and rate with sRestore
- clip = muvsfunc.srestore(source=clip, frate=23.9760)
- # Denoising using QTGMC
- clip = havsfunc.QTGMC(Input=clip, Preset="Fast", InputType=3, TR2=1, TFF=False, SourceMatch=0, Lossless=0, opencl=True)
- clip = core.std.AddBorders(clip=clip, left=0, right=0, top=2, bottom=2) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 1216x688
- # adjusting color space from YUV420P8 to RGBH for vsBasicVSRPPFilter
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_s="limited")
- # Quality enhancement using BasicVSR++
- from vsbasicvsrpp import basicvsrpp as BasicVSRPP
- clip = BasicVSRPP(clip=clip, model=4)
- clip = core.std.Crop(clip=clip, left=0, right=0, top=2, bottom=2) # removing borders (vsBasicVSRPPFilter) - 1216x684
- # adjusting output color from: RGBH to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", 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