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/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
- 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/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libvs_placebo.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
- # Import scripts
- import havsfunc
- import validate
- # Source: 'C:\Users\Selur\Desktop\wetransfer_lut-saturation-clip-1-mkv_2024-05-31_2022\P1070281.MP4'
- # Current color space: YUV420P8, bit depth: 8, resolution: 3840x2160, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709
- # Loading C:\Users\Selur\Desktop\wetransfer_lut-saturation-clip-1-mkv_2024-05-31_2022\P1070281.MP4 using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mp4_dc61bc143d24b5e37cfa4aa9c0fb0375_853323747.dgi")# 25 fps, scanorder: progressive
- frame = clip.get_frame(0)
- # Setting detected color matrix (709).
- clip = core.std.SetFrameProps(clip=clip, _Matrix=1)
- # setting color transfer (709), if it is not set.
- if validate.transferIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Transfer=1)
- # setting color primaries info (to 2020), if it is not set.
- if validate.primariesIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Primaries=9)
- # setting color range to TV (limited) range.
- clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
- # 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=0)# progressive
- # denoising using KNLMeansCL
- clip = core.knlm.KNLMeansCL(clip=clip, d=0, a=4, s=8, channels="Y")
- # applying debanding using vs-placebo.Deband
- clip = core.placebo.Deband(clip=clip, grain=0.00, planes=1)
- # adjusting color space from YUV420P8 to YUV444P16 for vsGLSLCAS
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
- with open("F:/Hybrid/64bit/vsfilters/GLSL/parameterized/CAS.glsl") as glslf:
- glsl = glslf.read()
- glsl = glsl.replace('#define SHARPENING 0.0', '#define SHARPENING 0.5')
- glsl = glsl.replace('#define CAS_BETTER_DIAGONALS 1', '#define CAS_BETTER_DIAGONALS 1')
- glsl = glsl.replace('#define CAS_GO_SLOWER 0', '#define CAS_GO_SLOWER 1')
- glsl = glsl.replace('#define SOURCE_TRC 0', '#define SOURCE_TRC 0')
- glsl = glsl.replace('#define TARGET_TRC 0', '#define TARGET_TRC 0')
- clip = core.placebo.Shader(clip=clip, shader_s=glsl, width=clip.width, height=clip.height)
- # applying dehalo using YAHR
- clip = havsfunc.YAHR(clip, depth=16)
- # 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 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