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/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DerainbowFilter/SmoothUV/libsmoothuv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libvs_placebo.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")
- 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/vslsmashsource.dll")
- # Import scripts
- import RainbowSmooth
- import SpotLess
- import havsfunc
- # source: 'C:\Users\Selur\Desktop\sample.mov'
- # current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: bottom field first
- # Loading C:\Users\Selur\Desktop\sample.mov using LWLibavSource
- clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/sample.mov", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
- # Setting detected color matrix (470bg).
- clip = core.std.SetFrameProps(clip, _Matrix=5)
- # Setting color transfer info (470bg), 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 (BT.601 PAL), 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=1) # bff
- # Deinterlacing using QTGMC
- clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False, opencl=True) # new fps: 50
- # Making sure content is preceived as frame based
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
- # adjusting color space from YUV420P8 to YUV444P16 for vsGLSLSaturation
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
- with open("F:/Hybrid/64bit/vsfilters/GLSL/parameterized/bSat.hook.glsl") as glslf:
- glsl = glslf.read()
- glsl = glsl.replace('#define SatFactor 2.43', '#define SatFactor 0.90')
- clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
- clip = core.std.CropRel(clip=clip, left=14, right=20, top=4, bottom=0)# cropping to 686x572
- # adjusting color space from YUV444P16 to RGB48 for vsLevels
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB48, matrix_in_s="470bg", range_s="limited")
- # Color Adjustment using Levels on RGB48 (16 bit)
- clip = core.std.Levels(clip=clip, min_in=4096, max_in=60160, min_out=4096, max_out=60160, gamma=0.85)
- # adjusting color space from RGB48 to YUV444P16 for vsSpotLess
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited")
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip=clip, radT=3, rec=True, pel=1)
- # adjusting color space from YUV444P16 to YUV444P8 for vsRainbowSmooth
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, range_s="limited", dither_type="error_diffusion")
- # rainbow removal using RainbowSmooth
- clip = RainbowSmooth.RainbowSmooth(clip=clip, radius=5)
- clip = havsfunc.DeHalo_alpha(clip, ry=3.00, brightstr=0.00, rx=3.00, darkstr=2.00)
- # removing flickering using ReduceFlicker
- clip = core.rdfl.ReduceFlicker(clip=clip, strength=3, aggressive=1)
- # removing flickering using ReduceFlicker
- clip = core.rdfl.ReduceFlicker(clip=clip, strength=3, aggressive=1)
- # removing flickering using ReduceFlicker
- clip = core.rdfl.ReduceFlicker(clip=clip, strength=3, aggressive=1)
- # Resizing using 10 - bicubic spline
- clip = core.fmtc.resample(clip=clip, kernel="spline16", w=704, h=550, interlaced=False, interlacedd=False) # resolution 704x550 before YUV444P8 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