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
- # 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/Support/akarin.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/vszip.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ColorFilter/TimeCube/vscube.dll")
- core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll")
- # Import scripts
- import color
- import validate
- # Source: 'C:\Users\Selur\Desktop\0001 pt 1-00.00.26.009-00.00.28.709.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\0001 pt 1-00.00.26.009-00.00.28.709.MP4' using DGSource
- clip = core.dgdecodenv.DGSource("J:/tmp/mp4_d5ca808afd56df4182c12d6a58241dd4_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) # scan type: progressive
- clip = core.std.Crop(clip, left=48, right=76, top=80, bottom=0) # cropping to 1316x1000
- # adjusting color space from YUV420P8 to RGB24 for vsTimeCube
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_in_s="limited", range_s="full")
- # color adjustment using TimeCube
- clip = core.timecube.Cube(clip, cube="F:/Hybrid/64bit/vsfilters/ColorFilter/TimeCube/BT709_to_PQ.cube")
- # adjusting color space from RGB24 to YUV444PS for vsColorMatrix
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444PS, matrix_s="709", range_in_s="full", range_s="limited", dither_type="error_diffusion") # additional resize to match target color sampling
- # ColorMatrix: adjusting color matrix from fcc to 709
- # adjusting luma range to 'limited' due to post clipping
- clip = core.resize.Bicubic(clip, matrix_in_s="fcc", matrix_s="709", range_in=0, range=0)
- # adjusting color space from YUV444PS to RGB48 for vsAutoWhite
- clip = core.resize.Bicubic(clip=clip, format=vs.RGB48, matrix_in_s="709", range_in_s="limited", range_s="full")
- # adjusting colors using AutoWhite
- clip = color.AutoWhite(clip)
- # adjusting color space from RGB48 to YUV444P16 for vsTweak
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="709", range_in_s="full", range_s="limited") # additional resize to match target color sampling
- # adjusting color using Tweak
- clip = color.Tweak(clip, hue=-45.00, sat=1.10, cont=1.00, coring=True)
- # adjusting output color from YUV444P16 to YUV420P10 for NVEncModel
- clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10)
- # set output frame rate to 30fps (progressive)
- clip = core.std.AssumeFPS(clip=clip, fpsnum=30, fpsden=1)
- # output
- clip.set_output()
- # script was created by Hybrid 2026.01.29.1
Advertisement
Add Comment
Please, Sign In to add comment