Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import vapoursynth as vs
- # getting Vapoursynth core
- import sys
- import os
- core = vs.core
- # Import scripts folder
- scriptPath = 'F:/Hybrid/64bit/vsscripts'
- sys.path.insert(0, os.path.abspath(scriptPath))
- # loading plugins
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libsangnom.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2.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/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
- # Import scripts
- import mvsfunc
- import havsfunc
- import masked
- import validate
- # Source: 'C:\Users\Selur\Desktop\RollerCoaster.mp4'
- # Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg
- # Loading C:\Users\Selur\Desktop\RollerCoaster.mp4 using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mp4_a19ebf792683f64d862a46eaf9f3d146_853323747.dgi")# 29.97 fps, scanorder: progressive
- frame = clip.get_frame(0)
- # Setting detected color matrix (470bg).
- clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
- # setting color transfer (170), if it is not set.
- if validate.transferIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
- # 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 29.97fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
- # making sure the detected scan type is set (detected: progressive)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
- ## Starting applying 'limit' masked filtering for vsAWarpSharp2
- clipMask = clip
- clipMask = core.resize.Bicubic(clip=clipMask, format=vs.GRAY8, range_s="limited")
- clipMask = core.std.BinarizeMask(clipMask, 160)
- clipFiltered = clip
- # sharpening using AWarpSharp2
- clipFiltered = core.warp.AWarpSharp2(clip=clipFiltered, blur=2, depth=42, planes=[0])
- clipMask = core.resize.Bicubic(clip=clipMask, format=vs.YUV420P8, range_s="limited")
- clip = core.std.MaskedMerge(clip, clipFiltered, clipMask) # LimitMask
- ## Finished applying 'LimitMask' masked filtering for vsAWarpSharp2
- # applying dehalo using DeHalo_alpha
- clip = havsfunc.DeHalo_alpha(clip, rx=2.50, ry=2.50, darkstr=1.20, brightstr=1.20)
- # applying anti aliasing using santiag
- clip = havsfunc.santiag(c=clip, nns=2, qual=2, pscrn=2, opencl=True)
- from vsdpir import dpir as DPIR
- # adjusting color space from YUV420P8 to RGBH for vsDPIRDenoise
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
- # denoising using DPIRDenoise
- clip = DPIR(clip=clip, strength=5.000, task="denoise", device_index=0, num_streams=3, trt=True, trt_cache_dir="J:/tmp")
- # no resizing since resolution is already archived
- # adjusting output color from: RGBH 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 29.97fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
- # output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement