Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import site
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("C:/Program Files/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
# 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/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# defining beforeDeinterlace-function - START
def beforeDeinterlace(clip):
clip = core.std.Transpose(clip)
return clip
# defining beforeDeinterlace-function - END
# defining beforeQTGMCFilter-function - START
def beforeQTGMCFilter(clip):
clip = core.std.Transpose(clip)
return clip
# defining beforeQTGMCFilter-function - END
# Import scripts
import G41Fun
import havsfunc
# source: 'F:\Temp-\AIRWOLF\SEIZOEN 4\0001.mkv'
# current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
# Loading F:\Temp-\AIRWOLF\SEIZOEN 4\0001.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/Temp-/AIRWOLF/SEIZOEN 4/0001.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip, _Matrix=5)
# Setting color transfer (to 470bg), if it is not set.
if '_Transfer' not in frame.props or not frame.props['_Transfer']:
clip = core.std.SetFrameProps(clip, _Transfer=5)
# Setting color primaries info (to 5), if it is not set.
if '_Primaries' not in frame.props or not frame.props['_Primaries']:
clip = 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 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2) # tff
# cutting from frame 0 to 2264 - WARNING: This might cause synch issues
clip = core.std.Trim(clip=clip, first=0, last=2264)
clip = beforeDeinterlace(clip)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Slower", TFF=True) # new fps: 25
# Making sure content is preceived as frame based
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
clip = clip[::2] # selecting previously even frames
# adjusting color space from YUV420P8 to RGB24 for vsLevels
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
# Color Adjustment using Levels on RGB24 (8 bit)
clip = core.std.Levels(clip=clip, min_in=0, max_in=255, min_out=0, max_out=255)
# adjusting color space from RGB24 to YUV444P8 for vsRemoveGrain
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited")
# removing grain using RemoveGrain
clip = core.rgvs.RemoveGrain(clip=clip, mode=24)
# denoising using KNLMeansCL
clip = havsfunc.KNLMeansCL(clip=clip, d=0, a=8, s=2, h=1.00)
clip = beforeQTGMCFilter(clip)
# Denoising using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Placebo", InputType=3, TR2=2, Sharpness=0.2, TFF=False, SourceMatch=2, Lossless=0, EZDenoise=0.35, NoisePreset="Fast", MatchPreset="Fast", MatchPreset2="Fast", MatchEnhance=1.00)
# sharpening using DetailSharpen
clip = G41Fun.DetailSharpen(clip=clip, sstr=2.000, ldmp=0.250, mode=0, med=True)
from vsrealesrgan import realesrgan as RealESRGAN
# adjusting color space from YUV444P8 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"F:\Temp-\AIRWOLF\SEIZOEN 4", denoise_strength=0.25) # 2880x2304
# resizing 2880x2304 to 1920x1080
# adjusting resizing
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="limited")
clip = core.fmtc.resample(clip=clip, w=1920, h=1080, kernel="sinc", interlaced=False, interlacedd=False)
# adjusting output color from: RGBS to YUV420P8 for x264Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
# set output frame rate to 25fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()
is properly added.
btw. youe script is badly wrong.
You should add the Transpose once before beforeQTGMCFilter and then directly after it. Not before the deinterlacing!
You stopped the processing after 376 frames,...
this does not look like anything is wrong, with Hybrid.