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.

Deinterlace only the frames flagged as interlaced
#5
Here's a more generic example for the custom section:
import ctypes
import sys
import os
import functools
Dllref = ctypes.windll.LoadLibrary("%FILTERPATH%s/Support/libfftw3f-3.dll")

core.std.LoadPlugin(path="%FILTERPATH%/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="%FILTERPATH%/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="%FILTERPATH%/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="%FILTERPATH%/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="%FILTERPATH%/Support/EEDI3m.dll")# vsQTGMC
core.std.LoadPlugin(path="%FILTERPATH%/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="%FILTERPATH%/Support/libmvtools.dll")
core.std.LoadPlugin(path="%FILTERPATH%/Support/fmtconv.dll")
core.std.LoadPlugin(path="%FILTERPATH%/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="%FILTERPATH%/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="%FILTERPATH%/DeinterlaceFilter/VIVTC/VIVTC.dll")
import qtgmc
clip2clip = clip
def postprocess(n, f, clip, deinterlaced):
  if f.props['_Combed'] > 0:
    return deinterlaced
  else:
    return clip
if clip.get_frame(0).props.get('_FieldBased', '') == vs.FIELD_TOP:
  tff = True
  order = 1
else:
  tff = False
  order = 0
clip2clip = qtgmc.QTGMC(Input=clip2clip, Preset="fast", TFF=tff, FPSDivisor=2)
clip = core.vivtc.VFM(clip=clip, order=order)
clip = core.std.FrameEval(clip=clip, eval=functools.partial(postprocess, clip=clip, deinterlaced=clip2clip), prop_src=clip)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# scantype progressive
But as I expected, this only works properly if VFM, correctly flags the fields.
Did a few tests and for me, at least with the default VFM settings
clip = core.vivtc.VFM(clip=clip, order=order)
that isn't always the case.
I got better results using TFM instead of VFM.
Here's also an example using TFM instead of VFM.
import ctypes
import sys
import os
import functools
Dllref = ctypes.windll.LoadLibrary("%FILTERPATH%/Support/libfftw3f-3.dll")

core.std.LoadPlugin(path="%FILTERPATH%/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="%FILTERPATH%/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="%FILTERPATH%/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="%FILTERPATH%/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="%FILTERPATH%/Support/EEDI3m.dll")# vsQTGMC
core.std.LoadPlugin(path="%FILTERPATH%/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="%FILTERPATH%/Support/libmvtools.dll")
core.std.LoadPlugin(path="%FILTERPATH%/Support/fmtconv.dll")
core.std.LoadPlugin(path="%FILTERPATH%/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="%FILTERPATH%/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="%FILTERPATH%/DeinterlaceFilter/TIVTC/libtivtc.dll")
import qtgmc
clip2clip = clip
def postprocess(n, f, clip, deinterlaced):
  if f.props['_Combed'] > 0:
    return deinterlaced
  else:
    return clip
if clip.get_frame(0).props.get('_FieldBased', '') == vs.FIELD_TOP:
  tff = True
  order = 1
else:
  tff = False
  order = 0
clip2clip = qtgmc.QTGMC(Input=clip2clip, Preset="fast", TFF=tff, FPSDivisor=2)
clip = core.tivtc.TFM(clip=clip)
clip = core.std.FrameEval(clip=clip, eval=functools.partial(postprocess, clip=clip, deinterlaced=clip2clip), prop_src=clip)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# scantype progressive

So you might have to either:
a. tweak the VFM settings, see: https://amusementclub.github.io/doc/plugins/vivtc.html
or
b. use TFM instead and potentially tweak its settings

Cu Selur

Ps.: Updated the dev version to support such code in the custom sections.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply


Messages In This Thread
RE: Deinterlace only the frames flagged as interlaced - by Selur - 24.03.2025, 23:54

Forum Jump:


Users browsing this thread: 1 Guest(s)