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/Support/libtemporalmedian.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ColorFilter/Grayworld/grayworld.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
- # Import scripts
- import SpotLess
- import adjust
- # source: 'C:\Users\Selur\Desktop\Rick 1st Comm Raw LINES.mp4'
- # current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 29.97, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
- # Loading C:\Users\Selur\Desktop\Rick 1st Comm Raw LINES.mp4 using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mp4_2be3aaa4b8a73f3bdd16f9de0fb86fed_853323747.dgi")# 29.97 fps, scanorder: progressive
- # Setting detected color matrix (709).
- clip = core.std.SetFrameProps(clip, _Matrix=1)
- # Setting color transfer info (709)
- clip = core.std.SetFrameProps(clip, _Transfer=1)
- # Setting color primaries info (1)
- 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 29.97
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, 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 RGBH for vsDDColor
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_s="limited")
- # adding colors using DDColor
- from vsddcolor import ddcolor
- clip = ddcolor(clip=clip, model=1, input_size=256)
- # adjusting color space from RGBH to RGBS for vsGrayworld
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="limited")
- # Color Adjustment using Grayworld
- # convert to linear color space
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", range_s="limited")
- # limit to 0-1
- clip = core.std.Limiter(clip, 0.0, 1.0)
- clip = core.grwrld.grayworld(clip=clip)
- # undo conversion to linear color space
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="709", transfer_in_s="linear", range_s="limited")
- # adjusting color space from RGBS to YUV444P16 for vsSpotLess
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="709", range_s="limited", dither_type="error_diffusion")
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip=clip, radT=2, pel=2)
- clip = core.std.CropRel(clip=clip, left=256, right=256, top=0, bottom=0)# cropping to 1408x1080
- # adjusting color space from YUV444P16 to RGBH for vsBasicVSRPPFilter
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_s="limited")
- # Quality enhancement using BasicVSR++
- from vsbasicvsrpp import basicvsrpp as BasicVSRPP
- clip = BasicVSRPP(clip=clip, model=6)
- # 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")
- # 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