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/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/TCanny.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libtemporalmedian.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/LSMASHSource.dll")
- # Import scripts
- import edi_rpow2
- import mcdegrainsharp
- import SpotLess
- import havsfunc
- # source: 'C:\Users\Selur\Desktop\sample.mov'
- # current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, scanorder: bottom field first, yuv luminance scale: limited, matrix: 470bg, transfer: bt.709, primaries: bt.601 pal
- # 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)
- frame = clip.get_frame(0)
- # Setting detected color matrix (470bg).
- clip = core.std.SetFrameProps(clip, _Matrix=5)
- # Setting color transfer (709), if it is not set.
- if '_Transfer' not in frame.props or not frame.props['_Transfer']:
- clip = core.std.SetFrameProps(clip, _Transfer=1)
- # Setting color primaries info (to 470), if it is not set.
- if '_Primaries' not in frame.props or not frame.props['_Primaries']:
- clip = 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=True, opencl=True) # new fps: 25
- # Making sure content is preceived as frame based
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
- clip = clip[::2] # selecting previously even frames
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip=clip, radT=2, pel=1)
- clip = core.std.CropRel(clip=clip, left=10, right=20, top=4, bottom=10)# cropping to 690x562
- # Fix bright and dark line artifacts near the border of an image using BalanceBorders
- clip = havsfunc.bbmod(c=clip,cLeft=16,cTop=0,cRight=0,cBottom=0)
- # removing grain using MCDegrain
- clip = mcdegrainsharp.mcdegrainsharp(clip=clip)
- # applying dehalo using YAHR
- clip = havsfunc.YAHR(clip, depth=16)
- clip = core.std.AddBorders(clip=clip, left=0, right=2, top=0, bottom=2) # add borders to archive mod 4 (NNEDI3(CL)) - 692x564
- # resizing using NNEDI3CL
- # current: 692x564 target: 1280x978 -> pow: 2
- clip = edi_rpow2.nnedi3cl_rpow2(clip=clip, rfactor=2, nsize=3) # 1384x1128
- clip = core.std.CropRel(clip=clip, left=0, right=4, top=0, bottom=4) # removing borders (NNEDI3(CL)) - 1380x1124
- # adjusting resizing
- clip = core.fmtc.resample(clip=clip, w=1280, h=978, kernel="spline64", interlaced=False, interlacedd=False)# before YUV420P8 after YUV420P16
- # adjusting output color from: YUV420P16 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 25fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
- # Output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement