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/DenoiseFilter/Cnr2/libcnr2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/MSmooth/libmsmoosh.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/temporalsoften.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.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 vsdeoldify as havc
- import fromDoom9
- import SpotLess
- import validate
- # Source: 'C:\Users\Selur\Desktop\videoplayback.mp4'
- # Current color space: YUV420P8, bit depth: 8, resolution: 320x240, frame rate: 30fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: AVC
- # Loading C:\Users\Selur\Desktop\videoplayback.mp4 using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mp4_f86918b1894211a32e040f0a408a05a1_853323747.dgi")# 30 fps, scanorder: progressive
- frame = clip.get_frame(0)
- # setting color matrix to 709.
- clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
- # setting color transfer (vs.TRANSFER_BT709), if it is not set.
- if validate.transferIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
- # setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
- if validate.primariesIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
- # setting color range to TV (limited) range.
- clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
- # making sure frame rate is set to 30fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30, fpsden=1)
- # making sure the detected scan type is set (detected: progressive)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
- # cutting from frame 5700 to 6599 - WARNING: This might cause synch issues
- clip = core.std.Trim(clip=clip, first=5700, last=6599)
- # adjusting color space from YUV420P8 to RGB24 for vsLevels
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_s="limited")
- # adjusting color using Levels on RGB24 (8 bit)
- clip = core.std.Levels(clip=clip, min_in=16, max_in=255, min_out=16, max_out=235, gamma=0.80)
- # adjusting color space from RGB24 to YUV444P16 for vsSpotLess
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="709", range_s="limited")
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip=clip, radT=3, rec=True, pel=1, smoother="zsmooth")
- # adjusting color space from YUV444P16 to YUV444P8 for vsSDeflicker
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, range_s="limited", dither_type="error_diffusion")
- # removing flickering using Small Deflicker
- clip = fromDoom9.Small_Deflicker(clip=clip, preset=3, cnr=True)
- clip = core.std.Crop(clip=clip, left=6, right=0, top=12, bottom=12)# cropping to 314x216
- clip = core.std.AddBorders(clip=clip, left=3, right=3, top=0, bottom=0) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 320x216
- # adjusting color space from YUV444P8 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=4)
- clip = core.std.Crop(clip=clip, left=3, right=3, top=0, bottom=0) # removing borders (vsBasicVSRPPFilter) - 314x216
- # changing range from limited to full range for vsHAVC
- clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
- # adjusting color space from RGBH to RGB24 for vsHAVC
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, range_s="full", dither_type="error_diffusion")
- # adding colors using HAVC
- clip = havc.HAVC_main(clip=clip, ColorTune="strong", EnableDeepEx=True, DeepExMethod=0, DeepExRefMerge=0, ScFrameDir=None, DeepExModel=1, DeepExEncMode=0)
- # changing range from full to limited range for vsHAVC
- clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
- # adjusting output color from: RGB24 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited")
- # set output frame rate to 30fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30, fpsden=1)
- # output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment