Had a quick look.
Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import ctypes
import os
import site
core = vs.core
# Adding torch dependencies to PATH
path = site.getsitepackages()[0]+'/torch_dependencies/bin/'
ctypes.windll.kernel32.SetDllDirectoryW(path)
path = path.replace('\\', '/')
os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
# Loading Plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/AviSource/avisource.dll")
# source: 'E:\Film-Tape Captures\Tests\Hybrid Test video.avi'
# current color space: YUV422P8, bit depth: 8, resolution: 720x480, fps: 59.94, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading E:\Film-Tape Captures\Tests\Hybrid Test video.avi using VsAviSource
clip = core.avisource.AVISource(path="E:/Film-Tape Captures/Tests/Hybrid Test video.avi")
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip, _Matrix=5)
# Setting color transfer info (470bg), when it is not set
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
# Setting color primaries info (), when it is not set
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 59.94
clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
# Weighted resize - START
clipSmoothed = clip
# Resizing using fmtconv - cubic
clipSmoothed = core.fmtc.resample(clip=clipSmoothed, kernel="linear", w=1440, h=960, interlaced=False, interlacedd=False) # resolution 1440x960 before YUV422P8 after YUV422P16
from vsrealesrgan import realesrgan as RealESRGAN
# adjusting color space from YUV422P8 to RGBH for vsRealESRGAN
clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="470bg", range_s="limited")
# resizing using RealESRGAN
clip = RealESRGAN(clip=clip, model=5, device_index=0, trt=True, trt_cache_path=r"C:\Users\Dan\AppData\Local\Temp", num_streams=2) # 2880x1920
# resizing 2880x1920 to 1440x960
# adjusting resizing
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="limited")
clip = core.fmtc.resample(clip=clip, w=1440, h=960, kernel="lanczos", interlaced=False, interlacedd=False)
clipSmoothed = core.resize.Bicubic(clip=clipSmoothed, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
clip = core.std.Merge(clipa=clipSmoothed,clipb=clip,weight=0.5)
# Weighted resize - END
# adjusting output color from: RGBS to YUV422P8 for x264Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P8, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
# set output frame rate to 59.94fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
# Output
clip.set_output()
Script seems fine to me and the Vapoursynth preview works so, it should not be an issue with the script itself.
1. changing the default temp path (Config->Paths) before creating the job, maybe something is interfering with the piping between vspipe and x264.
2. setting an exemption in your virus scanner for the temp folder.