# 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/MiscFilter/MiscFilters/MiscFilters.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll") # Import scripts import validate # Source: 'C:\Users\Selur\Desktop\sample_FINE_720.mp4' # Current color space: YUV420P8, bit depth: 8, resolution: 1280x720, frame rate: 23.976fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: AVC # Loading C:\Users\Selur\Desktop\sample_FINE_720.mp4 using DGSource clip = core.dgdecodenv.DGSource("J:/tmp/mp4_2b5f81df175fe091cb10549a6329d5db_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. clip = core.std.SetFrameProps(clip=clip, _ColorRange=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) # progressive # changing range from limited to full range for vsProPainter clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full") # setting color range to PC (full) range. clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_FULL) # adjusting color space from YUV420P8 to RGB24 for vsProPainter clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_s="full") # Inpainting using ProPainter from vspropainter import propainter as ProPainter clipMask = core.lsmas.LWLibavSource(source="G:/Output/mask.mp4", format="RGB24", cache=0) clip = ProPainter(clip=clip, clip_mask=clipMask, length=12, mask_dilation=12, mask_region=(500,256,380,240)) # changing range from full to limited range for vsProPainter clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited") # adjusting output color from: RGB24 to YUV420P10 for NVEncModel clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited") # set output frame rate to 23.976fps (progressive) clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001) # output clip.set_output()