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/Support/libmvtools_sf_em64t.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/TCanny.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/HQDN3D/libhqdn3d.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/DePan.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ColorFilter/Retinex/Retinex.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/LSmashSource/vslsmashsource.dll")
- # Import scripts
- import G41Fun
- import SpotLess
- import masked
- import lostfunc
- import havsfunc
- # source: 'C:\Users\Selur\Desktop\Oxford Sample 2.avi'
- # current color space: YUV411P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: bottom field first
- # Loading C:\Users\Selur\Desktop\Oxford Sample 2.avi using LWLibavSource
- clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Oxford Sample 2.avi", format="YUV411P8", stream_index=0, cache=0, prefer_hw=2)
- # 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)
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1)
- # adjusting color space from YUV411P8 to YUV444P8 for VsQTGMC
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, range_s="limited")
- # setting field order to what QTGMC should assume (bottom field first)
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1)
- # Deinterlacing using QTGMC
- clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False, opencl=True) # new fps: 59.94
- # make sure content is preceived as frame based
- clip = core.std.SetFieldBased(clip, 0)
- # color adjustment using Retinex
- clip = core.retinex.MSRCP(input=clip, sigma=[40,120,250], lower_thr=0.200, fulls=False, fulld=False, chroma_protect=1.500)
- # adjusting color space from YUV444P8 to RGB24 for vsLevels
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
- # Color Adjustment using Levels on RGB24 (8 bit)
- clip = core.std.Levels(clip=clip, min_in=16, max_in=235, min_out=16, max_out=235, gamma=0.90)
- # adjusting color space from RGB24 to YUV444P8 for vsStab
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited")
- # stabilizing using Stab
- clip = lostfunc.Stab(clp=clip,range=3,mirror=0)
- # cropping the video to 704x480
- clip = core.std.CropRel(clip=clip, left=8, right=8, top=0, bottom=0)
- ## Starting applying 'limit' masked filtering for vsHQDN3D
- clipMask = clip
- clipMask = core.std.BinarizeMask(clipMask, 50, planes=[0])
- clipMask = core.std.InvertMask(clipMask)
- clipFiltered = clip
- # denoising using HQDN3D
- clipFiltered = core.hqdn3d.Hqdn3d(clip=clipFiltered, lum_spac=24.00, lum_tmp=54.00)
- clip = core.std.MaskedMerge(clip, clipFiltered, clipMask)
- ## Finished applying 'limit' masked filtering for vsHQDN3D
- clip = SpotLess.SpotLess(clip=clip, radT=3)
- # removing grain using TemporalDegrain2
- clip = G41Fun.TemporalDegrain2(clip=clip, degrainPlane=4, meAlgPar=False, meTM=True, postFFT=0, fftThreads=1)
- # adjusting output color from: YUV444P8 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
- # set output frame rate to 59.94fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
- # Output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment