Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imports
- import ctypes
- import sys
- import os
- import vapoursynth as vs
- # using Vapoursynth R79
- # getting Vapoursynth core
- core = vs.core
- # 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/znedi3.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/sneedif/libsneedif.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/eedi3m.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/vszip/vszip.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/addnoise.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/mvutensils/mvutensils.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/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/tivtc.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
- # defining beforeGrayworld-function - START
- def beforeGrayworld(clip):
- def set_interp_flag(n, f):
- f = f.copy()
- mics = f.props.get("TFMMics")
- use = (mics is not None and len(mics) >= 3
- and (mics[0] == 256 or mics[1] == 256))
- f.props._UseInterp = 1 if use else 0
- return f
- flagged = core.std.ModifyFrame(clip, clip, set_interp_flag)
- clip = flagged
- MAX_RUN = 8 # bigger than the longest run you actually expect
- for _ in range(MAX_RUN):
- prev = core.std.BlankClip(clip, length=1) + \
- core.std.Trim(clip, 0, clip.num_frames - 2)
- clip = core.akarin.Select([clip, prev], flagged, "x._UseInterp 1 0 ?")
- return [clip]
- # defining beforeGrayworld-function - END
- # Import scripts
- import qtgmc
- import validate
- # Source: 'C:\Users\Selur\Desktop\segment3.avi'
- # clip current meta; color space: YUV422P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: field-shifted, full height: true (Source)
- # Loading 'C:\Users\Selur\Desktop\segment3.avi' using LWLibavSource
- clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/segment3.avi", format="YUV422P8", stream_index=0, cache=0, prefer_hw=0)
- 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: field-shifted)
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # scan type: top field first
- # Field matching using TFM
- clip = core.tivtc.TFM(clip, mChroma=False)
- # Making sure content is perceived as frame based
- clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive
- [clip] = beforeGrayworld(clip)
- # clip current meta; color space: YUV422P8, 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
- # Denoising using QTGMC
- clip = qtgmc.QTGMC(clip, Preset="Fast", InputType=3, TR2=1, TFF=False, SourceMatch=0, Lossless=0)
- # adjusting output color from YUV422P8 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
- # 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: 720x576, 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.09.12.1
Advertisement
Add Comment
Please, Sign In to add comment