Advertisement
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/SharpenFilter/CAS/CAS.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/Interframe/svpflow2_vs64.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/Interframe/svpflow1_vs64.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/RemoveDirt/RemoveDirtVS.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/EdgeFixer/EdgeFixer.dll")
- 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/SourceFilter/LSmashSource/LSMASHSource.dll")
- # Import scripts
- import removeDirt
- import SpotLess
- import havsfunc
- # source: 'C:\Users\Selur\Desktop\PAL SD_sample.mkv'
- # current color space: YUV422P10, bit depth: 10, resolution: 720x576, fps: 25, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg
- # Loading C:\Users\Selur\Desktop\PAL SD_sample.mkv using LWLibavSource
- clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/PAL SD_sample.mkv", format="YUV422P10", stream_index=0, cache=0, prefer_hw=0)
- frame = clip.get_frame(0)
- # Setting detected color matrix (470bg).
- clip = core.std.SetFrameProps(clip, _Matrix=5)
- # Setting color transfer (170), if it is not set.
- if '_Transfer' not in frame.props or not frame.props['_Transfer']:
- clip = core.std.SetFrameProps(clip, _Transfer=6)
- # Setting color primaries info (to 470), 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 25
- clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
- clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
- clip = havsfunc.Vinverse(clp=clip)
- # Spot removal using SpotLess
- clip = SpotLess.SpotLess(clip=clip, radT=2, pel=1)
- clip = core.std.CropRel(clip=clip, left=18, right=16, top=2, bottom=6)# cropping to 686x568
- # Fix bright and dark line artifacts near the border of an image using EdgeFixer
- clip = core.edgefixer.Continuity(clip=clip,bottom=4,radius=3)
- # Fix bright and dark line artifacts near the border of an image using BalanceBorders
- clip = havsfunc.bbmod(c=clip,cLeft=12,cTop=8,cRight=12,cBottom=0)
- clip = core.std.AddBorders(clip=clip, left=8, right=10, top=0, bottom=0) # add borders to archive mod 8 (vsRemoveDirtMC) - 704x568
- # adjusting color space from YUV422P10 to YUV420P8 for vsRemoveDirtMC
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited", dither_type="error_diffusion")
- # denoising using VsRemoveDirtMC
- clip = removeDirt.RemoveDirtMC(input=clip, remgrainmode=12, limit=10, gpu=True)
- clip = core.std.CropRel(clip=clip, left=8, right=10, top=0, bottom=0) # removing borders (vsRemoveDirtMC) - 686x568
- clip = core.fmtc.resample(clip=clip, w=960, h=794, kernel="spline64", interlaced=False, interlacedd=False)# adjusting for 'wanted width' (vsBasicVSRPPFilter)
- clip = core.std.AddBorders(clip=clip, left=0, right=0, top=2, bottom=4) # add borders to archive mod 8 (vsBasicVSRPPFilter) - 960x800
- # adjusting color space from YUV420P16 to RGBH for vsBasicVSRPPFilter
- clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
- # Quality enhancement using BasicVSR++
- from vsbasicvsrpp import basicvsrpp as BasicVSRPP
- clip = BasicVSRPP(clip=clip, model=4, length=100)
- clip = core.std.CropRel(clip=clip, left=0, right=0, top=2, bottom=4) # removing borders (vsBasicVSRPPFilter) - 960x794
- # adjusting color space from RGBH to RGB48 for vsCAS
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB48, range_s="limited")
- # contrast sharpening using CAS
- clip = core.cas.CAS(clip=clip, sharpness=0.600)
- # Resizing using 10 - bicubic spline
- clip = core.fmtc.resample(clip=clip, kernel="spline16", w=1280, h=1060, interlaced=False, interlacedd=False) # resolution 1280x1060 before RGB48 after RGB48
- # adjusting output color from: RGB48 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 25fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
- # Output
- clip.set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement