Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - # Imports
 - import vapoursynth as vs
 - # getting Vapoursynth core
 - 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))
 - os.environ["CUDA_MODULE_LOADING"] = "LAZY"
 - # loading plugins
 - core.std.LoadPlugin(path="F:/Hybrid/64bit/vs-mlrt/vstrt.dll")
 - core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
 - core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
 - core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ColorFilter/TimeCube/vscube.dll")
 - core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
 - # Import scripts
 - from importlib.machinery import SourceFileLoader
 - vsmlrt = SourceFileLoader('vsmlrt', 'F:/Hybrid/64bit/vs-mlrt/vsmlrt.py').load_module()
 - import lostfunc
 - import validate
 - # Source: 'C:\Users\Selur\Desktop\0130_Cut_without_re-encoding.MP4'
 - # Current color space: YUV420P8, bit depth: 8, resolution: 1440x1080, frame rate: 30fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, format: AVC
 - # Loading C:\Users\Selur\Desktop\0130_Cut_without_re-encoding.MP4 using DGSource
 - clip = core.dgdecodenv.DGSource("J:/tmp/mp4_ca879f4d93d92a4557693ba98d03d0d1_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_BT709), if it is not set.
 - if validate.primariesIsInvalid(clip):
 - clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT709)
 - # 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
 - # adjusting color space from YUV420P8 to RGB24 for vsTimeCube
 - clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_s="limited")
 - # color adjustment using TimeCube
 - clip = core.timecube.Cube(clip=clip, cube="F:/Hybrid/64bit/vsfilters/ColorFilter/TimeCube/color/AGF - Optima + film.cube")
 - # adjusting color space from RGB24 to YUV444P16 for vsDeSpot
 - clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="709", range_s="limited")
 - clip = lostfunc.DeSpot(o=clip)
 - # 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=4)
 - from vsmlrt import Backend
 - # changing range from limited to full range for vsSCUNetmlrt
 - clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
 - # denosing using SCUNet (mlrt)
 - clip = vsmlrt.SCUNet(clip, model=4, overlap=16, backend=Backend.TRT(fp16=True,device_id=0,verbose=True,use_cuda_graph=False, num_streams=3,builder_optimization_level=3,engine_folder="J:/TRT"))
 - # changing range from full to limited range for vsSCUNetmlrt
 - clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
 - # 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 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