# 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/RIFE/librife.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.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/DenoiseFilter/CTMF/CTMF.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.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/fmtconv.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/akarin.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/d2vSource/DGDecode.dll") # defining beforeRotation-function - START def beforeRotation(clip): import muvsfunc # requires colorformat YUV420P8 core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmedian.dll") clip = muvsfunc.Cdeblend(input=clip,omode=1) clip = muvsfunc.Cdeblend(input=clip,omode=2) return clip # defining beforeRotation-function - END # Import scripts import denoise import nnedi3_resample import smdegrain import srestore import qtgmc import validate # Source: 'C:\Users\Selur\Desktop\V03-P02-01.mpg' # Current color space: YUV420P8, bit depth: 8, resolution: 704x480, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg, transfer: bt.470 system b/g, primaries: bt.601 pal, format: mpeg-2 # Loading C:\Users\Selur\Desktop\V03-P02-01.mpg using DGDecode clip = core.dgdecode.MPEG2Source("J:/tmp/mpg_bfbaaec9c29f5be169a78686596d30ab_853323747.d2v",info=3)# 29.97 fps, scanorder: top field first frame = clip.get_frame(0) # setting color matrix to 470bg. clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG) # setting color transfer (vs.TRANSFER_BT470_BG), if it is not set. if validate.transferIsInvalid(clip): clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT470_BG) # 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 29.97fps clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001) # 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 = qtgmc.QTGMC(Input=clip, Preset="Fast", TFF=True, opencl=True) # new fps: 59.94 # Making sure content is preceived as frame based clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive clip = core.std.Crop(clip=clip, left=0, right=0, top=30, bottom=38)# cropping to 704x412 clip = beforeRotation(clip) # adjusting frame count and rate with sRestore clip = srestore.sRestoreMUVs(source=clip, omode="pp3") # removing grain using SMDegrain clip = smdegrain.SMDegrain(input=clip, tr=3, thSAD=1200, interlaced=False, opencl=True, device=-1) # denoising using MCTemporalDenoise clip = denoise.MCTemporalDenoise(i=clip, settings="very high", ncpu=10) # adjusting color space from YUV420P8 to RGBS for vsFillDuplicateFrames clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited") from FillDuplicateFrames import FillDuplicateFrames fdf = FillDuplicateFrames(clip=clip, method="RIFE", thresh=0.010000, rifeModel=68) clip = fdf.out # Resizing using 10 - bicubic spline clip = core.fmtc.resample(clip=clip, kernel="spline16", w=704, h=454, interlaced=False, interlacedd=False) # resolution 704x454 # adjusting output color from: RGBS to YUV420P10 for NVEncModel clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion") # set output frame rate to 59.94fps (progressive) clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001) # output clip.set_output()