Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import vapoursynth as vs
- # getting Vapoursynth core
- core = vs.core
- import site
- import os
- import ctypes
- # 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"]
- os.environ["CUDA_MODULE_LOADING"] = "LAZY"
- # Loading Plugins
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
- core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
- # source: 'G:\TestClips&Co\files\lossless\suzie_lossless..mp4'
- # current color space: YUV444P8, bit depth: 8, resolution: 176x144, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
- # Loading G:\TestClips&Co\files\lossless\suzie_lossless..mp4 using LibavSMASHSource
- clip = core.lsmas.LibavSMASHSource(source="G:/TestClips&Co/files/lossless/suzie_lossless..mp4")
- # Setting detected color matrix (470bg).
- clip = core.std.SetFrameProps(clip, _Matrix=5)
- # Setting color transfer info (470bg), when it is not set
- clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
- # Setting color primaries info (), when it is not set
- clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
- # 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
- # adjusting color space from YUV444P8 to RGBS for vsBasicVSRPP
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
- # Step 1: current: 176x144, target: 1056x796
- # resizing using BasicVSRPP
- from vsbasicvsrpp import BasicVSRPP
- # target zoom factor: 6 adjusted to 4
- clip = BasicVSRPP(clip=clip, model=2, fp16=True) # 704x576
- # resizing 704x576 to 1056x796
- # Step 2: current: 704x576, target: 1920x1436
- # resizing using BasicVSRPP
- # target zoom factor: 3 adjusted to 4
- clip = BasicVSRPP(clip=clip, model=2, fp16=True) # 2816x2304
- # resizing 2816x2304 to 1920x1436
- # adjusting resizing
- clip = core.fmtc.resample(clip=clip, w=1920, h=1436, kernel="lanczos", interlaced=False, interlacedd=False)
- # adjusting output color from: RGBS to YUV420P10 for x265Model
- 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