Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import vapoursynth as vs
- # getting Vapoursynth core
- import sys
- import ctypes
- import os
- import site
- 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/libsangnom.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
- # Import scripts
- import havsfunc
- import mvsfunc
- # source: 'C:\Users\Selur\Desktop\sample.mov'
- # current color space: YUV422P10, bit depth: 10, resolution: 720x486, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: telecine
- # Loading C:\Users\Selur\Desktop\sample.mov using LibavSMASHSource
- clip = core.lsmas.LibavSMASHSource(source="C:/Users/Selur/Desktop/sample.mov")
- frame = clip.get_frame(0)
- # Setting detected color matrix (470bg).
- clip = core.std.SetFrameProps(clip, _Matrix=5)
- # Setting color transfer (to 470bg), if it is not set.
- if '_Transfer' not in frame.props or not frame.props['_Transfer']:
- clip = core.std.SetFrameProps(clip, _Transfer=5)
- # Setting color primaries info (to 5), if it is not set.
- if '_Primaries' not in frame.props or not frame.props['_Primaries']:
- clip = 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
- # Deinterlacing using TIVTC
- clip = core.tivtc.TFM(clip=clip)
- clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976
- # Making sure content is preceived as frame based
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
- # Making sure content is preceived as frame based
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
- # contrast sharpening using CAS
- clip = core.cas.CAS(clip=clip, sharpness=0.600)
- from vsfemasr import femasr as FeMaSR
- clip = core.std.AddBorders(clip=clip, left=0, right=0, top=0, bottom=2) # add borders to archive mod 4 (vsFeMaSR) - 720x488
- # adjusting color space from YUV422P10 to RGBH for vsFeMaSR
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
- # resizing using FeMaSR
- clip = FeMaSR(clip=clip, device_index=0) # 1440x976
- # resizing 1440x976 to 1456x1080
- clip = core.std.CropRel(clip=clip, left=0, right=0, top=0, bottom=4) # removing borders (vsFeMaSR) - 1440x972
- # adjusting resizing
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="limited")
- clip = core.fmtc.resample(clip=clip, w=1456, h=1080, kernel="spline64", interlaced=False, interlacedd=False)
- # applying anti aliasing using santiag
- clip = havsfunc.santiag(c=clip, pscrn=1)
- # adjusting output color from: RGBS 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 23.976fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
- # Output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment