Selur's Little Message Board

Full Version: Thoughts about vs_deinterlace?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Did anyone try https://github.com/pifroggi/vs_deepdeinterlace ?

(includes DfConvEkSA, DeF, DDD bob deinterlacing)
If did some preliminary tests and seems to work (as expected, rather slow), but does not seem to provide any real gains over QTGMC as far as I have seen. (on some frames it does seem to provide some small details, which at least the not tweaked presets miss)

=> So unless someone finds some cases where it is better than conventional deinterlacing, I do not plan to add this to Hybrid,...

----
To test it, you can copy the vs_deepdeinterlace-folder, from the repository, into your Vapoursynth/Lib/site-packages folder and use it like described in on the website, all needed dependencies seem to be already included in the torch package.


Cu Selur
QTGMC is one of the greatest tools in Hybrid.  On rare occasions, I've seen QTGMC audio get out of sync from captures from vhs / camcoder.  The audio is in sync when playing the deinterlace material.   I very much want to test this, perhaps it will solve those rare audio sync issue.  I'm struggling getting it working, due to my lack of experience.  So I added the folder as you've instructed.  For a Bottom Field First video, how do I add this code?

Code:
import vs_deepdeinterlace
clip = vs_deepdeinterlace.DDD(clip, tff=False, tta=False, device="cuda", fp16=True)

I don't know if these are the correct steps, it gives me errors.   I "Show Vapoursynth Script"  copy and paste to vsViewer, add those two lines above and press F5 to test.
Please assist.
Sync issues are not related to the deinterlacer method.
Those are more likely related to vfr or glitches in the source.

Here's an example core I use to compare QTGMC to DeepDeinterlace:
Code:
# 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")# 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/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/DGDecNV/DGDecodeNV.dll")
# Import scripts
import havsfunc
import validate
import vs_deepdeinterlace
# Source: 'G:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\bff.m2v'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: bottom field first, yuv luminance scale: limited, matrix: 470bg
# Loading G:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\bff.m2v using DGSource
clip = core.dgdecodenv.DGSource("J:/tmp/m2v_478bc6d007ec94bfc67367d30d9093a4_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: bottom field first
frame = clip.get_frame(0)
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
# setting color transfer (170), if it is not set.
if validate.transferIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
# setting color primaries info (to 470), if it is not set.
if validate.primariesIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
# 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: bottom field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=1) # bff
# Deinterlacing using QTGMC
qtgmc = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False, opencl=True) # new fps: 59.94
# adjusting output color from: RGBS to YUV420P10 for Output
qtgmc = core.resize.Bicubic(clip=qtgmc, format=vs.YUV420P10)

# adjusting color space from YUV420P8 to RGBS for vsRealSR
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
clip = vs_deepdeinterlace.DDD(clip, tff=False, tta=False, device="cuda", fp16=True)
# adjusting output color from: RGBS to YUV420P10 for Output
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")


clip = core.std.Interleave([qtgmc.text.Text("QTGMC"), clip.text.Text("DD")])


# set output frame rate to 59.94fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
# output
clip.set_output()

Cu Selur
If you are adventurous, you could even use DDD in QTGMC, for example:
Code:
# 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")# 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/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/DGDecNV/DGDecodeNV.dll")
# Import scripts
import vs_deepdeinterlace
import havsfunc
import validate
# Source: 'G:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\bff.m2v'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x480, frame rate: 29.97fps, scanorder: bottom field first, yuv luminance scale: limited, matrix: 470bg
# Loading G:\TestClips&Co\files\interlaceAndTelecineSamples\interlaced\bff.m2v using DGSource
clip = core.dgdecodenv.DGSource("J:/tmp/m2v_478bc6d007ec94bfc67367d30d9093a4_853323747.dgi",fieldop=0)# 29.97 fps, scanorder: bottom field first
frame = clip.get_frame(0)
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
# setting color transfer (170), if it is not set.
if validate.transferIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
# setting color primaries info (to 470), if it is not set.
if validate.primariesIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
# 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: bottom field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=1) # bff
# 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="470bg", range_s="limited")
clipEdiExt = vs_deepdeinterlace.DDD(clip=clipEdiExt, tff=False, device="cuda")
# Making sure content is preceived as frame based
clipEdiExt = core.std.SetFrameProps(clip=clipEdiExt, _FieldBased=0) # progressive
clipEdiExt = core.resize.Bicubic(clip=clipEdiExt, format=vs.YUV420P8, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
clip = havsfunc.QTGMC(Input=clip, Preset="Slower", InputType=0, TFF=False, TR2=1, SourceMatch=0, Lossless=0, opencl=True, EdiExt=clipEdiExt) # new fps: 59.94
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
# 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 59.94fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
# output
clip.set_output()
which is suggested on the vs_deepdeinterlace homepage. Smile
Quote:If you would like to finetune or improve the results, consider using one of these deinterlacers as "EdiExt"-clip in QTGMC.
see: https://github.com/pifroggi/vs_deepdeinterlace

Cu Selur
Uploaded a Hybrid_vs_deepdeinterlace.zip to my GoogleDrive inside the 'experimental' folder.
This dev allows to:
a. use vs_deepdeinterlace as deinterlacer
b. use DDD in QTGMC (preset "Custom") as EdiExt

Cu Selur
Thank you for letting me try this, you are a legend.  This is quite slowww, you were right about that part.   A 3 minute video clip took about 1 minute in QTGMC and over an hour with DDD, I couldn't tell the difference quality wise.