Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import ctypes
- import sys
- import os
- import vapoursynth as vs
- # getting Vapoursynth core
- core = vs.core
- # Limit frame cache to 48449MB
- core.max_cache_size = 48449
- # Import scripts folder
- scriptPath = 'F:/Hybrid/64bit/vsscripts'
- sys.path.insert(0, os.path.abspath(scriptPath))
- # Loading Support Files
- Dllref = ctypes.windll.LoadLibrary("F:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
- # loading plugins
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/deblock.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/RemoveDirt/RemoveDirt.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/FrameFilter/ReduceFlicker/ReduceFlicker.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/vcm.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/hysteresis/hysteresis.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvtools.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/d2vSource/DGDecode.dll")
- # Import scripts
- import denoise
- import removeDirt
- import edge
- import SpotLess
- import validate
- # Source: 'C:\Users\Selur\Desktop\5 - stereo.mpeg'
- # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true (Source)
- # Loading 'C:\Users\Selur\Desktop\5 - stereo.mpeg' using DGDecode
- clip = core.dgdecode.MPEG2Source("J:/tmp/mpeg_99e8642d0f318c6ba643ee3eaf232651_853323747.d2v",info=3)# 25 fps, scanorder: progressive
- frame = clip.get_frame(0)
- # setting color matrix to 470bg.
- clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT470_BG)
- # setting color transfer (vs.TRANSFER_BT601), if it is not set.
- if validate.transferIsInvalid(clip):
- clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT601)
- # 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.
- prop_name = '_Range' if core.core_version.release_major >= 74 else '_ColorRange'
- clip = core.std.SetFrameProps(clip=clip, **{prop_name: vs.RANGE_LIMITED})
- # making sure frame rate is set to 25fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
- # making sure the detected scan type is set (detected: progressive)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- # Spot removal using SpotLess + DeltaRestore
- clip = SpotLess.SpotDelta(clip, radT=3, rec=True, pel=1, dark2_brt=0.97)
- # adjusting color space from YUV420P8 to YUV444P8 for vsDeJitter
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8)
- # remove jitter using DeJitter
- clip = core.vcm.DeJitter(clip)
- # removing flickering using ReduceFlicker
- clip = core.rdfl.ReduceFlicker(clip, strength=3, aggressive=1)
- clip = core.std.Crop(clip, left=28, right=6, top=2, bottom=16) # cropping to 686x558
- # Fix bright and dark line artifacts near the border of an image using BalanceBorders
- clip = edge.bbmod(clip, cLeft=8, cTop=8, cRight=0, cBottom=0)
- # denoising using VsRemoveDirtMC
- clip = removeDirt.RemoveDirtMC(clip)
- clip = core.std.AddBorders(clip=clip, left=1, right=1, top=1, bottom=1) # add borders to archive mod 4 (vsMCTemporalDenoise) - 688x560
- # denoising using MCTemporalDenoise
- clip = denoise.MCTemporalDenoise(clip, settings="very high", ncpu=10)
- clip = core.std.Crop(clip=clip, left=1, right=1, top=1, bottom=1) # removing added borders from mod requirement (vsMCTemporalDenoise) - 686x558
- # Resizing using 10 - bicubic spline
- clip = core.fmtc.resample(clip, kernel="spline16", w=686, h=524, interlaced=False, interlacedd=False) # resolution 686x524 before YUV444P8 after YUV444P16
- # adjusting output color from YUV444P16 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, 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()
- # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 686x524, fps: 25, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
- # script was created by Hybrid 2026.06.21.1
Advertisement
Add Comment
Please, Sign In to add comment