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/libfftw3-3.dll")
- Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
- # loading plugins
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DebandFilter/Flash3kDeband/flash3kyuu_deband.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/TCanny.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/vcm.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmotionmask.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/DFTTest/DFTTest.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")# vsQTGMC
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.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/MiscFilter/MiscFilters/MiscFilters.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/BestSource/BestSource.dll")
- # Import scripts
- import mclean
- import mvsfunc
- import muvsfunc
- import havsfunc
- import validate
- # Source: 'C:\Users\Selur\Desktop\test2.mov'
- # Current color space: YUV444P12, bit depth: 12, resolution: 720x576, frame rate: 25fps, scanorder: top field first, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709
- # Loading C:\Users\Selur\Desktop\test2.mov using BestSource (NOT recommended and untested!)
- clip = core.bs.VideoSource(source="C:/Users/Selur/Desktop/test2.mov", cachepath="J:/tmp/test2.json", track=0)
- 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_BT470_BG), if it is not set.
- if validate.primariesIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
- # setting color range to TV (limited) range.
- clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
- # making sure frame rate is set to 25fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
- # making sure the detected scan type is set (detected: top field first)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # tff
- # Deinterlacing using QTGMC
- clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 50
- # Making sure content is preceived as frame based
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
- clip = core.std.CropRel(clip=clip, left=12, right=12, top=2, bottom=2)# cropping to 696x572
- ## Starting applying 'MotionMask' masked filtering for vsBalanceBorders
- clipMask = clip
- clipMask = core.motionmask.MotionMask(clip=clipMask, th1=10, th2=10, tht=15)
- clipMask = core.std.Minimum(clipMask)
- clipMask = core.resize.Bicubic(clip=clipMask, format=vs.GRAY16, range_s="limited")
- clipMask = core.std.InvertMask(clipMask)
- clipFiltered = clip
- # Fix bright and dark line artifacts near the border of an image using BalanceBorders
- clipFiltered = havsfunc.bbmod(c=clipFiltered,cLeft=64,cTop=0,cRight=0,cBottom=0,thresh=30)
- clipMask = core.resize.Bicubic(clip=clipMask, format=vs.YUV444P12, range_s="limited", dither_type="error_diffusion")
- clip = core.std.MaskedMerge(clip, clipFiltered, clipMask) # MotionMask
- ## Finished applying 'MotionMask' masked filtering for vsBalanceBorders
- # denoising using mClean
- clip = mclean.mClean(clip=clip)
- # Resizing using 10 - bicubic spline
- clip = core.fmtc.resample(clip=clip, kernel="spline16", w=1280, h=964, interlaced=False, interlacedd=False) # resolution 1280x964 before YUV444P12 after YUV444P16
- # adjusting output color from: YUV444P16 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited", dither_type="error_diffusion")
- # set output frame rate to 50fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
- # output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement