Advertisement
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))
- # Loading Plugins
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
- 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_opencl.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/DGDecNV/DGDecodeNV.dll")
- # Import scripts
- import mvsfunc
- import havsfunc
- # source: 'C:\Users\Selur\Desktop\12_clip.mkv'
- # current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
- # Loading C:\Users\Selur\Desktop\12_clip.mkv using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mkv_d7b47a921725e8cb59f6b938f4efa5a6_853323747.dgi",fieldop=0)# 25 fps, scanorder: top field first
- # Setting detected color matrix (470bg).
- clip = core.std.SetFrameProps(clip, _Matrix=5)
- # Setting color transfer info, when it is not set
- clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
- # Setting color primaries info, when it is not set
- 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 25
- clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
- 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="Slow", TFF=True, opencl=True) # new fps: 50
- # make sure content is preceived as frame based
- clip = core.std.SetFieldBased(clip, 0)
- # cropping the video to 714x572
- clip = core.std.CropRel(clip=clip, left=4, right=2, top=2, bottom=2)
- clip = core.std.AddBorders(clip=clip, left=0, right=2, top=0, bottom=0) # add borders to archive mod 4 (vsQTGMCFilter) - 716x572
- # Denoising using QTGMC
- clip = havsfunc.QTGMC(Input=clip, Preset="Fast", InputType=1, TR2=1, SourceMatch=0, Lossless=0, opencl=True)
- clip = core.std.CropRel(clip=clip, left=0, right=2, top=0, bottom=0) # removing borders (vsQTGMCFilter) - 714x572
- # applying dehalo using YAHR
- clip = havsfunc.YAHR(clip)
- # line darkening using Toon
- clip = havsfunc.Toon(input=clip,str=2.00,blur=4)
- clip = core.std.AddBorders(clip=clip, left=0, right=6, top=0, bottom=4) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 720x576
- # adjusting color space from YUV420P8 to RGBS for vsBasicVSRPPFilter
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
- # Quality enhancement using BasicVSR++
- from vsbasicvsrpp import BasicVSRPP
- clip = BasicVSRPP(clip=clip, model=3, interval=1, fp16=True)
- clip = core.std.CropRel(clip=clip, left=0, right=6, top=0, bottom=4) # removing borders (vsBasicVSRPPFilter) - 714x572
- # Resizing using 10 - bicubic spline
- clip = core.fmtc.resample(clip=clip, kernel="spline16", w=1024, h=770, interlaced=False, interlacedd=False) # resolution 1024x770
- # adjusting output color from: RGBS 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 50fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
- # Output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement