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/libvs_placebo.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/DCTFilter.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.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/LSmashSource/LSMASHSource.dll")
- # Import scripts
- import masked
- import chromashift
- import autowhite
- import havsfunc
- import validate
- # Source: 'C:\Users\Selur\Desktop\NewNaughty-sample.mov'
- # Current color space: YUV422P10, bit depth: 10, resolution: 720x576, frame rate: 25fps, scanorder: bottom field first, yuv luminance scale: limited, matrix: 470bg, transfer: bt.709, primaries: bt.601 pal
- # Loading C:\Users\Selur\Desktop\NewNaughty-sample.mov using LibavSMASHSource
- clip = core.lsmas.LibavSMASHSource(source="C:/Users/Selur/Desktop/NewNaughty-sample.mov")
- frame = clip.get_frame(0)
- # Setting detected color matrix (470bg).
- clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
- # setting color transfer (709), if it is not set.
- if validate.transferIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Transfer=1)
- # setting color primaries info (to 470), if it is not set.
- if validate.primariesIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
- # setting color range to TV (limited) range.
- clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
- # 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: bottom field first)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=1) # bff
- # Deinterlacing using QTGMC
- clip = havsfunc.QTGMC(Input=clip, Preset="Fast", InputType=0, TFF=False, TR2=0, SourceMatch=0, Lossless=0, EZDenoise=4.00, NoisePreset="Fast", opencl=True) # new fps: 50
- # Making sure content is preceived as frame based
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
- # adjusting color space from YUV422P10 to RGB30 for vsAutoWhite
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB30, matrix_in_s="470bg", range_s="limited")
- # adjustint colors using AutoWhite
- clip = autowhite.AutoWhite(clip=clip)
- # adjusting color space from RGB30 to YUV444P10 for vsChromaShiftSP
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P10, matrix_s="470bg", range_s="limited")
- # Chroma adjustment using ChromaShiftSP
- clip = chromashift.ChromaShiftSP(clip=clip, X=0.50)
- # applying deblocking using DeBlock QED
- clip = havsfunc.Deblock_QED(clip)
- clip = core.std.CropRel(clip=clip, left=20, right=24, top=8, bottom=4)# cropping to 676x564
- # denoising using KNLMeansCL
- ## Starting applying 'limit' masked filtering for vsKNLMeansCL
- clipMask = clip
- clipMask = core.resize.Bicubic(clip=clipMask, format=vs.GRAY16, range_s="limited")
- clipMask = core.std.BinarizeMask(clipMask, 25600)
- clipFiltered = clip
- clipFiltered = havsfunc.KNLMeansCL(clip=clipFiltered, d=3)
- clipMask = core.resize.Bicubic(clip=clipMask, format=vs.YUV444P10, range_s="limited", dither_type="error_diffusion")
- clip = core.std.MaskedMerge(clip, clipFiltered, clipMask) # LimitMask
- ## Finished applying 'LimitMask' masked filtering for vsKNLMeansCL
- # applying dehalo using YAHR
- clip = havsfunc.YAHR(clip, blur=1)
- clip = havsfunc.EdgeCleaner(c=clip)
- # adjusting color space from YUV444P10 to YUV444P16 for vsGLSLFilmGrain
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
- with open("F:/Hybrid/64bit/vsfilters/GLSL/parameterized/filmgrain.glsl") as glslf:
- glsl = glslf.read()
- glsl = glsl.replace('#define INTENSITY 0.05', '#define INTENSITY 0.02')
- clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
- # 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