Selur's Little Message Board
[HELP] QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Printable Version

+- Selur's Little Message Board (https://forum.selur.net)
+-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html)
+--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html)
+--- Thread: [HELP] QTGMC appears to not be deinterlacing footage (or not doing so correctly) (/thread-3453.html)

Pages: 1 2 3 4


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Selur - 28.10.2023

Best open the "Filtering->Vapoursynth Script View" (lower right corner) this way you can see what script Hybrid is creating with the settings you gave it.
In the 'Addition' field you simply add stuff to the command line.
The script you see would look something like:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import ctypes
import sys
import os
core = vs.core
# 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")
# Loading Plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.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/Support/libmvtools.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import havsfunc
# source: 'C:\Users\Selur\Desktop\S01E01 Plunder & Lightning Pt. 1.mkv'
# current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: telecine
# Loading C:\Users\Selur\Desktop\S01E01 Plunder & Lightning Pt. 1.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/S01E01 Plunder & Lightning Pt. 1.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
# 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 29.97
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Faster", InputType=0, TFF=True, TR2=0, SourceMatch=0, Lossless=2) # new fps: 29.97
# 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 output color from: YUV420P8 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
# set output frame rate to 29.97fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# Output
clip.set_output()
The important part is the:
clip = havsfunc.QTGMC(Input=clip, Preset="Faster", InputType=0, TFF=True, TR2=0, SourceMatch=0, Lossless=2) # new fps: 29.97
If you add for example ", NoiseProcess=2" (note the comma at the beginning) under Addition you get:
clip = havsfunc.QTGMC(Input=clip, Preset="Faster", InputType=0, TFF=True, TR2=0, SourceMatch=0, Lossless=2, opencl=True, NoiseProcess=2) # new fps: 29.97
Smile
Using:
[Image: grafik.png]
and as Addition:
, 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, NoisePreset="slow", StabilizeNoise=False, NoiseTR=0, NoiseDeint="bob"
results in:
clip = havsfunc.QTGMC(Input=clip, Preset="Slow", InputType=0, TFF=True, TR2=2, Sharpness=0.1, SourceMatch=3, Lossless=2, MatchPreset="Slow", 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, NoisePreset="slow", StabilizeNoise=False, NoiseTR=0, NoiseDeint="bob") # new fps: 29.97
which, unless I missed something, should be what was suggested in the videohelp thread.
(note that they used 'StabilizeNoise=false', but since this is Vapoursynth not Avisynth one needs to use 'StabilizeNoise=False')

Cu Selur


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Perseverant - 16.11.2023

I never thanked you for all of that great detail (thank you!!!)

I wanted to give you some feedback in case it's helpful in any way:
The Dev version you made for me is automatically selecting TIVTC when I import one of my files, even if I have already selected and saved a different option (QTGMC).  Is there a way to prevent my saved defaults from changing?  Also, are the changes you made for my dev build going to eventually make their way into the official product, or should I just stick with the dev build moving forward for this kind of content?

As a result of the TIVTC auto-select, I accidentally upscaled a couple of files that were TIVTC'd rather than QTGMC'd, and the thing that made me catch it were two things:  The quality was noticeably worse for the TIVTC'd content, and the file sizes were bigger.

Here's a quality comparison (look at the fur detail on the right side of Baloo's head).
https://imgsli.com/MjIwNjk1

One of the TIVTC'd files was bigger than its QTGMC'd counterpart (did not expect that!), but both TIVTC'd files produced much larger upscaled files.  One episode was 881MB with a QTGMC'd source, and 1.05GB with a TIVTC'd source, where no other parameters were changed.  Not the results I would've expected!


Thanks for reading  Big Grin


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Selur - 16.11.2023

Quote:Also, are the changes you made for my dev build going to eventually make their way into the official product, or should I just stick with the dev build moving forward for this kind of content?
Usually stuff I add to the dev version makes it into the normal releases unless they break something I was not aware of when adding them.

Quote:Is there a way to prevent my saved defaults from changing?
Saved defaults should not change,....
I did a quick test, by setting the QTGMC addition to:
, 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, NoisePreset="slow", StabilizeNoise=False, NoiseTR=0, NoiseDeint="bob"
save these in the defaults in Hybrid and they are still there.
Can't reproduce a problem.


Personally I would filter more than just deinterlacing or IVTC, for example behalo, anti-alias, denoise, line darkening, luma sharpening,.... Tongue

Cu Selur


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Perseverant - 16.11.2023

About the default settings changing, this is what is happening:
1) Launch Hybrid.  RESULT: Filtering is set to "QTGMC (Vapoursynth)" since it is set as a default.
2) Load one of the interlaced files, I've been working with.  RESULT: Filtering has now been changed to "TIVTC (Vapoursynth)"

Now, if I change the filtering back to "QTGMC (Vapoursynth)" and load a 2nd, 3rd, 4th, 5th file, etc. etc. it will stay on QTGMC.  It's just when I load that first file that it alters the default filtering method.  I didn't know if that was by-design, but if it is, it would be nice to have a 'retain defaults regardless of media loaded' option.

Quote:Personally I would filter more than just deinterlacing or IVTC, for example behalo, anti-alias, denoise, line darkening, luma sharpening,.... [Image: tongue.png]
I know what you mean, and I bet you'd be able to come up with a great result.  I just reached a point in A:B testing where I don't have the time/energy to keep tweaking things, so had to stick with a more generic approach that produced excellent output after the upscaling was complete.


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Selur - 16.11.2023

Quote:2) Load one of the interlaced files, I've been working with. RESULT: Filtering has now been changed to "TIVTC (Vapoursynth)"
That should only happen if your source is detected as 'telecine' or 'telecine (soft)'. => check what the source is detected as.
I did change some code not to long ago that changes the detection a bit.
Can you share a debug output (better a sample) of one of your sources where this happens?

Cu Selur


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Perseverant - 16.11.2023

Not sure if you still have the file from earlier in our discussion, but it's the same content you identified it as "telecined" previously: https://forum.selur.net/thread-3453-post-19879.html#pid19879

I am interested in locking the filtering to QTGMC even if the source is identified as telecined since that has yielded favorable results in my upscales.

If you still want a debug file I can get you one, but based on your response it sounds like what's happening is by-design.  It's not the end of the world if I always have to go and change the filtering back to what I want after loading a file since it only happens for the first file, just would be nice to have a "force defaults" type option.


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Selur - 16.11.2023

Quote:based on your response it sounds like what's happening is by-design.
Yes, it is. Smile

Quote:I am interested in locking the filtering to QTGMC even if the source is identified as telecined since that has yielded favorable results in my upscales.
Ah, okay, no problem, then overwrite the scanorder to 'tff' and save that to your defaults. Wink
(no need for debug output)

Cu Selur


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Perseverant - 16.11.2023

That worked wonderfully.  You're the best!  Big Grin


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Perseverant - 28.11.2023

Hey Selur,

I've run into another strange problem with the content (which appears to vary from earlier content in this same series).  When I run this file through the exact same process, the framerate is being altered to 14.985FPS and the file freezes halfway through.  Later episodes show similar behavior after going through Hybrid where they'll freeze halfway through and/or have wild total playback time values of 1910:11:12 in VLC.  The source files all play without issues.

Can you help me determine why this is happening?

Here is an example episode (please let me know once you've downloaded and I'll remove it): https://mega.nz/file/LFJFxBpQ#dLvq5ozGxXxPdVpQlGj6rZ2kwa3yJ7hMGibNXdeFf3Y

Here are my settings in the dev version of Hybrid you made for me: https://i.ibb.co/8KnP6pV/Hybrid-Settings.jpg


RE: QTGMC appears to not be deinterlacing footage (or not doing so correctly) - Selur - 28.11.2023

The problem seems to be that the source content is detected as 24.367fps vfr. (which is too far away from 23.976 to trigger some workarounds)
Enabling: "Config->Internals->Prefer Original->Frame rate" before loading the source should help.

Cu Selur