This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[BUG] Problem with QTGMC + EdiExt + Def + more
#4
Quote:Could you please advise me on the best way to deal with this type of content in your program to obtain the best possible result?
No clue about the 'best possible' way, but here's how I would start.
Looking at the file.
First thing I noticed, when bobbing the content, every frame is duplicated, so the content isn't really interlaced.
Looking at the content when overwriting the scan type to progressive, you see combing.
The content isn't interlaced (at least not all the time), but probably field shifted or telecined (or a mix).Smile
Looking at the fields separated:
[Image: grafik.png][Image: grafik.png]
so there is already ghosting in some of the fields. Sad
When disabling bobbing, you still see duplicates, so the content probably is telecined.
So either using TFM+TIVTC or QTGMC(Bob)+sRestore(frate=23.9760), neither of these is perfect.

=> For interlaced handling, I would probably use TFM+TIVTC and add Santiag (or Vinverse2) after it.
For denoising&co I would probably use MCDegrainSharp and sharpen additionally a bit with CAS(0.6 or 0.7). But I can't really say whether that is something you might want to do. (Additionally, adding DPIRDeblock(mlrt) at the end might help)
So here's the script I end up with:
# Imports import vapoursynth as vs # getting Vapoursynth core import logging import site import sys import os core = vs.core # Limit frame cache to 48473MB core.max_cache_size = 48473 # Import scripts folder scriptPath = 'F:/Hybrid/64bit/vsscripts' sys.path.insert(0, os.path.abspath(scriptPath)) os.environ["CUDA_MODULE_LOADING"] = "LAZY" # Force logging to std:err logging.StreamHandler(sys.stderr) # loading plugins core.std.LoadPlugin(path="F:/Hybrid/64bit/vs-mlrt/vstrt.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libsangnom.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll") # Import scripts from importlib.machinery import SourceFileLoader vsmlrt = SourceFileLoader('vsmlrt', 'F:/Hybrid/64bit/vs-mlrt/vsmlrt.py').load_module() from vsmlrt import Backend import antiAliasing import validate # Source: 'C:\Users\Selur\Desktop\C-15-Genesis - Three Sides Live (1982) [2014 Blu-ray].mkv' # Current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, frame rate: 29.97fps, scanorder: telecine, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: AVC # Loading C:\Users\Selur\Desktop\C-15-Genesis - Three Sides Live (1982) [2014 Blu-ray].mkv using DGSource clip = core.dgdecodenv.DGSource("J:/tmp/mkv_4baacdb2bacedf5b6d10360e0d08f745_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: telecine 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 29.97fps clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001) # making sure the detected scan type is set (detected: telecine) clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # tff # Deinterlacing using TIVTC clip = core.tivtc.TFM(clip=clip) clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976 # Making sure content is preceived as frame based clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive # applying anti aliasing using santiag clip = antiAliasing.santiag(c=clip, nns=2, qual=2, pscrn=2, opencl=True) clip = core.std.Crop(clip=clip, left=240, right=240, top=0, bottom=0)# cropping to 1440x1080 # contrast sharpening using CAS clip = core.cas.CAS(clip=clip, sharpness=0.700) # adjusting color space from YUV420P8 to RGBH for vsDPIRmlrtDeblock clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_in_s="limited", range_s="full") # adjusting deblocking using DPIR (mlrt) clip = vsmlrt.DPIR(clip = clip, strength=50.000, model=3, backend=Backend.TRT(fp16=True,device_id=0,bf16=False,verbose=True,use_cuda_graph=True,num_streams=3,builder_optimization_level=3,engine_folder="J:/TRT")) # adjusting output color from: RGBH to YUV420P10 for NVEncModel clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_in_s="full", range_s="limited", dither_type="error_diffusion") # additional resize to allow target color sampling # set output frame rate to 23.976fps (progressive) clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001) # output clip.set_output()
(note, that I changed the filter order compared to the default order)

Alternatively, with QTGMC and sRestore and something like:
# Imports import vapoursynth as vs # getting Vapoursynth core import logging import site import ctypes import sys import os core = vs.core # Limit frame cache to 48473MB core.max_cache_size = 48473 # 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") os.environ["CUDA_MODULE_LOADING"] = "LAZY" # Force logging to std:err logging.StreamHandler(sys.stderr) # loading plugins core.std.LoadPlugin(path="F:/Hybrid/64bit/vs-mlrt/vstrt.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libsangnom.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI2.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/ZSmooth/zsmooth.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.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/dfttest2_nvrtc.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/EEDI3m_opencl.dll")# vsQTGMC core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/NNEDI3CL.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libmvtools.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/akarin.dll") core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV_AVX2.dll") # Import scripts from importlib.machinery import SourceFileLoader vsmlrt = SourceFileLoader('vsmlrt', 'F:/Hybrid/64bit/vs-mlrt/vsmlrt.py').load_module() from vsmlrt import Backend import srestore import antiAliasing import vs_deepdeinterlace import dfttest2 import qtgmc import validate # Source: 'C:\Users\Selur\Desktop\C-15-Genesis - Three Sides Live (1982) [2014 Blu-ray].mkv' # Current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, frame rate: 29.97fps, scanorder: top field first, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: AVC # Loading C:\Users\Selur\Desktop\C-15-Genesis - Three Sides Live (1982) [2014 Blu-ray].mkv using DGSource clip = core.dgdecodenv.DGSource("J:/tmp/mkv_4baacdb2bacedf5b6d10360e0d08f745_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: top field first 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 29.97fps clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001) # making sure the detected scan type is set (detected: top field first) clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_TOP) # tff # Deinterlacing using QTGMC clipEdiExt = clip # adjusting color space from YUV420P8 to RGBS for vsDDD clipEdiExt = core.resize.Bicubic(clip=clipEdiExt, format=vs.RGBS, matrix_in_s="709", range_in_s="limited", range_s="full") clipEdiExt = vs_deepdeinterlace.DDD(clip=clipEdiExt, tff=True, fp16=True, device="cuda") # Making sure content is preceived as frame based clipEdiExt = core.std.SetFrameProps(clip=clipEdiExt, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive clipEdiExt = core.resize.Bicubic(clip=clipEdiExt, format=vs.YUV420P8, matrix_s="709", range_in_s="full", range_s="limited", dither_type="error_diffusion") # additional resize to allow target color sampling clip = qtgmc.QTGMC(Input=clip, Preset="Fast", InputType=0, TFF=True, TR2=1, SourceMatch=0, Lossless=0, opencl=True, EdiExt=clipEdiExt, TR0=2, TR1=2, Rep0=1, Rep1=0, Rep2=4, DCT=5, ThSCD1=300, ThSCD2=110, Sbb=0, NoiseProcess=2, GrainRestore=0.0, NoiseRestore=0.4, StabilizeNoise=False, NoiseTR=0, NoiseDeint="bob") # new fps: 59.94 # Making sure content is preceived as frame based clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive # applying anti aliasing using santiag clip = antiAliasing.santiag(c=clip, nns=2, qual=2, pscrn=2, opencl=True) # adjusting frame count and rate with sRestore clip = srestore.sRestoreMUVs(source=clip, frate=23.9760) clip = core.std.Crop(clip=clip, left=240, right=240, top=0, bottom=0)# cropping to 1440x1080 # contrast sharpening using CAS clip = core.cas.CAS(clip=clip, sharpness=0.700) # adjusting color space from YUV420P8 to RGBH for vsDPIRmlrtDeblock clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_in_s="limited", range_s="full") # adjusting deblocking using DPIR (mlrt) clip = vsmlrt.DPIR(clip = clip, strength=50.000, model=3, backend=Backend.TRT(fp16=True,device_id=0,bf16=False,verbose=True,use_cuda_graph=True,num_streams=3,builder_optimization_level=3,engine_folder="J:/TRT")) # adjusting output color from: RGBH to YUV420P10 for NVEncModel clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_in_s="full", range_s="limited", dither_type="error_diffusion") # additional resize to allow target color sampling # set output frame rate to 23.976fps (progressive) clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001) # output clip.set_output()
(not sure whether this is better, but it is even slower; sadly there is no faster sRestore for Vapoursynth)

Whether you want to denoise or sharpen the content more is up to your preference. (applying for example DetailSharpen seems to be too much for me https://imgsli.com/NDE2ODc5)

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply


Messages In This Thread
RE: Problem with QTGMC + EdiExt + Def + more - by Selur - 21.09.2025, 15:25

Forum Jump:


Users browsing this thread: 1 Guest(s)