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
- # Limit frame cache to 48473MB
- core.max_cache_size = 48473
- # 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/ResizeFilter/nnedi3/NNEDI3CL.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/dfttest2_nvrtc.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DerainbowFilter/SSIQ/libssiq.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.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/Support/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/akarin.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/d2vSource/DGDecode.dll")
- # Import scripts
- import edi_rpow2
- import dfttest2
- import nnedi3_resample
- import smdegrain
- import artifacts
- import SpotLess
- import deblock
- import sharpen
- import validate
- # Source: 'C:\Users\Selur\Desktop\A_1.mpg'
- # Current color space: YUV420P8, bit depth: 8, resolution: 352x288, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg, format: mpeg-1
- # Loading C:\Users\Selur\Desktop\A_1.mpg using DGDecode
- clip = core.dgdecode.MPEG2Source("J:/tmp/mpg_fc4111cf4fb0f3393b1111ac0d285cab_853323747.d2v",info=3)# 25 fps, scanorder: progressive
- 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_BT601), if it is not set.
- if validate.transferIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
- # 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 25fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
- # making sure the detected scan type is set (detected: progressive)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
- # adjusting color space from YUV420P8 to RGB24 for vsLevels
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
- # adjusting color using Levels on RGB24 (8 bit)
- clip = core.std.Levels(clip=clip, min_in=32, max_in=196, min_out=16, max_out=235)
- # sharpening using DetailSharpen
- clip = sharpen.DetailSharpen(clip=clip)
- # contrast sharpening using CAS
- clip = core.cas.CAS(clip=clip, sharpness=0.700)
- # adjusting color space from RGB24 to YUV444PS for vsDeblockQED
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444PS, matrix_s="470bg", range_s="limited")
- # applying deblocking using DeBlock QED
- clip = deblock.Deblock_QED(clip, quant1=60, quant2=60, aOff2=5, bOff2=5)
- # adjusting color space from YUV444PS to YUV444P16 for vsSpotLess
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited", dither_type="error_diffusion")
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip=clip, radT=3, rec=True, pel=1, smoother="zsmooth")
- clip = artifacts.DeSpot(o=clip)
- clip = core.std.Crop(clip=clip, left=0, right=8, top=6, bottom=2)# cropping to 344x280
- # adjusting color space from YUV444P16 to YUV420P8 for vsSSIQ
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited", dither_type="error_diffusion")
- # rainbow removal using SSIQ
- clip = core.ssiq.SSIQ(clip=clip, interlaced=0)
- # removing grain using SMDegrain
- clip = smdegrain.SMDegrain(input=clip, tr=3, thSAD=1300, thSADC=512, RefineMotion=True, interlaced=False, prefilter=3, dct=1, opencl=True, device=-1)
- # resizing using NNEDI3CL
- # current: 344x280 target: 1416x1080 -> pow: 8
- clip = edi_rpow2.nnedi3cl_rpow2(clip=clip, rfactor=8, nns=1) # 2752x2240
- # resizing 2752x2240 to 1416x1080
- clip = core.fmtc.resample(clip=clip, w=1416, h=1080, 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