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 site
- import sys
- import os
- core = vs.core
- # Import scripts folder
- scriptPath = 'F:/Hybrid/64bit/vsscripts'
- sys.path.insert(0, os.path.abspath(scriptPath))
- # Adding torch dependencies to PATH
- path = site.getsitepackages()[0]+'/torch_dependencies/bin/'
- ctypes.windll.kernel32.SetDllDirectoryW(path)
- path = path.replace('\\', '/')
- os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
- # Loading Plugins
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
- # Import scripts
- import nnedi3_resample
- import mvsfunc
- import smdegrain
- import havsfunc
- import autowhite
- import adjust
- # source: 'C:\Users\Selur\Desktop\Video.720p.BW.h264.Test_30s.mp4'
- # current color space: YUV420P8, bit depth: 8, resolution: 1280x692, fps: 23.976, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
- # Loading C:\Users\Selur\Desktop\Video.720p.BW.h264.Test_30s.mp4 using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mp4_80d9bd52db8ea63586977a0845f435f4_853323747.dgi")# 23.976 fps, scanorder: progressive
- frame = clip.get_frame(0)
- # Setting detected color matrix (709).
- clip = core.std.SetFrameProps(clip, _Matrix=1)
- # Setting color transfer (to 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 1), if it is not set.
- if '_Primaries' not in frame.props or not frame.props['_Primaries']:
- clip = core.std.SetFrameProps(clip, _Primaries=1)
- # Setting color range to TV (limited) range.
- clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
- # making sure frame rate is set to 23.976
- clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
- # Color Adjustment
- clip = adjust.Tweak(clip=clip, hue=0.00, sat=0.00, cont=1.00, coring=True)
- # adjusting color space from YUV420P8 to RGB24 for vsAutoWhite
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_s="limited")
- # adjustint colors using AutoWhite
- clip = autowhite.AutoWhite(clip=clip)
- # adjusting color space from RGB24 to YUV444P8 for vsSMDegrain
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="709", range_s="limited")
- # removing grain using SMDegrain
- clip = smdegrain.SMDegrain(input=clip, interlaced=False, dct=1)
- from vsscunet import scunet as SCUNet
- # adjusting color space from YUV444P8 to RGBS for vsSCUNet
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", range_s="limited")
- # denoising using SCUNet
- clip = SCUNet(clip=clip, model=4, cuda_graphs=True)
- # adjusting color space from RGBS to RGBH for vsDDColor
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, range_s="limited", dither_type="error_diffusion")
- # adding colors using DDColor
- from vsddcolor import ddcolor
- clip = ddcolor(clip=clip, model=1, input_size=256)
- # adjusting output color from: RGBH to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited", dither_type="error_diffusion")
- # Output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement