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/DenoiseFilter/CTMF/CTMF.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/HQDN3D/libhqdn3d.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.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/GrainFilter/RemoveGrain/RemoveGrainVS.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/SourceFilter/d2vSource/d2vsource.dll")
- # Import scripts
- import rescued
- import havsfunc
- # source: 'C:\Users\Selur\Desktop\VTS_01_1.demuxed.m2v'
- # current color space: YUV420P8, bit depth: 8, resolution: 704x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: telecine
- # Loading C:\Users\Selur\Desktop\VTS_01_1.demuxed.m2v using D2VSource
- clip = core.d2v.Source(input="E:/Temp/m2v_83dd13dfe4f9aeb8ccbb12702dbe2152_853323747.d2v")
- # Setting color matrix to 470bg.
- clip = core.std.SetFrameProps(clip, _Matrix=5)
- clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
- 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)
- clip2clip = clip
- clip2clip = havsfunc.QTGMC(Input=clip2clip, Preset="fast", opencl=True, TFF=True,FPSDivisor=2)
- # Deinterlacing using TIVTC
- clip = core.tivtc.TFM(clip=clip, clip2=clip2clip)
- clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976
- # make sure content is preceived as frame based
- clip = core.std.SetFieldBased(clip, 0)
- clip = havsfunc.Vinverse(clp=clip)
- # cropping the video to 664x268
- clip = core.std.CropRel(clip=clip, left=24, right=16, top=106, bottom=106)
- clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=4) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 664x272
- # 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, fp16=True)
- clip = core.std.CropRel(clip=clip, left=0, right=0, top=0, bottom=4) # removing borders (vsBasicVSRPPFilter) - 664x268
- # adjusting color space from RGBS to YUV444P8 for vsTemporalDegrain
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited", dither_type="none")
- # removing grain using TemporalDegrain
- clip = rescued.TemporalDegrain(inpClip=clip)
- # Resizing using 10 - bicubic spline
- clip = core.fmtc.resample(clip=clip, kernel="spline16", w=720, h=328, interlaced=False, interlacedd=False) # resolution 720x328
- # adjusting output color from: YUV444P16 to YUV420P10 for x265Model
- clip = core.resize.Bicubic(clip=clip, dither_type="none", format=vs.YUV420P10, range_s="limited")
- # set output frame rate to 23.976fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
- # Output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement