Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import sys
- import os
- import vapoursynth as vs
- # using Vapoursynth R78
- # 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 plugins
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/akarin/libakarin.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/zsmooth/zsmooth.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
- # defining beforeEnd-function - START
- def beforeEnd(clip):
- mod = clip
- for _ in range(2):
- mod = core.std.Expr(mod,expr=["x 180 > x 0.80 * 35 + x ?", "", ""] )
- edges = core.std.Sobel(clip.std.ShufflePlanes(0, vs.GRAY))
- mask = edges
- for _ in range(3):
- mask = core.std.Maximum(mask)
- mask = core.std.BoxBlur(mask, hradius=3, vradius=3)
- clip = core.std.MaskedMerge(clip, mod, mask)
- return [clip]
- # defining beforeEnd-function - END
- # Import scripts
- import sharpen
- import dehalo
- import validate
- # Source: 'G:\clips\halo\heavyhaloremovalogsample.ts'
- # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 1440x1080, fps: 23.976, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Source)
- # Loading 'G:\clips\halo\heavyhaloremovalogsample.ts' using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/ts_050a3135ec1bd5ee205d5bb3d0ce01fa_853323747.dgi") # 23.976 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.
- 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 23.976fps
- clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
- # making sure the detected scan type is set (detected: progressive)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- # Field matching using TFM
- clip = core.tivtc.TFM(clip)
- # applying dehalo using DeHalo_alpha
- clip = dehalo.DeHalo_alpha(clip, rx=4.00, ry=4.00, darkstr=0.00)
- # applying dehalo using YAHR
- for i in range(0,4):
- clip = dehalo.YAHR(clip, depth=64)
- [clip] = beforeEnd(clip)
- # clip current meta; color space: YUV420P8, bit depth: 8, resolution: 1440x1080, fps: 23.976, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true
- # adjusting output color from YUV420P8 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
- # set output frame rate to 23.976fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
- # output
- clip.set_output()
- # clip current meta; color space: YUV420P10, bit depth: 10, resolution: 1440x1080, fps: 23.976, color matrix: 709, color primaries: Unspecific, color transfer: BT.709, yuv luminance scale: limited, scanorder: progressive, full height: true (Meta)
- # script was created by Hybrid 2026.07.20.1
Advertisement
Add Comment
Please, Sign In to add comment