Vapoursynth VIVTC

From wiki.selur.net
Revision as of 11:13, 16 November 2026 by Selur (talk | contribs) (Label is now "Comb threshold" (via update-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

VIVTC is VapourSynth's own inverse telecine pair VFM + VDecimate, derived from TIVTC: VFM matches fields to recover the progressive frames, VDecimate drops one duplicate per cycle (29.97 → 23.976 fps for NTSC film).

Filtering → (De-)Interlace/Telecine → Inverse telecine

VIVTC controls in Hybrid
VIVTC controls in Hybrid

What it does

For every frame VFM keeps the field pairing with the least combing and marks frames that are still combed. Hybrid replaces those frames with the matching frame of a helper deinterlacer. VDecimate then removes the most similar frame of every cycle. The field matcher alone is available as VFM.

Settings

Options are only written when they differ from the defaults (Hybrid's defaults are the plugin's).

VFM

Control Parameter Range / values Hybrid default Meaning
Mode mode 0 – 5 1 (p/c + n) Which matches are tried; higher modes try more matches and are more aggressive.
Field field 0 – 3 2 Field to match from: 0 = bottom, 1 = top, 2 = same as the field order, 3 = opposite.
Chroma matching mchroma on/off on Include chroma in the match decision.
Comb threshold cthresh −1 – 255 9 Combing threshold (8-bit scale; the plugin scales it).
Mi mi 0 – Block X × Block Y 80 Combed pixels in one block above which a frame counts as combed.
Chroma comb detection chroma on/off on Include chroma in the combing detection.
Block (X/Y) blockx / blocky 4 – 512 16 / 16 Block size of the combing detection.
Exclude y0 / y1 0 – 64 / 16 – 64 16 / 16 Rows excluded from the match decision; off when equal.
Scene threshold scthresh 0 – 100 12 Scene change threshold in percent.
Mic match micmatch 0 – 2 1 How the combing values (mics) influence the match decision.
Mic out micout on/off off Write the mic values of all matches to the frame properties.
Deinterlacer – QTGMC fast / medium / slow / Very Slow, NNEDI3 QTGMC fast Helper that provides the replacement for frames VFM marks as combed.

VDecimate

Control Parameter Range / values Hybrid default Meaning
Cycle cycle 2 – 100 5 One frame is dropped per Cycle frames.
Chroma chroma on/off on Include chroma in the duplicate metrics.
Dup threshold dupthresh 0 – 100 1.1 Difference in percent below which a frame counts as a duplicate.
Scene threshold scthresh 0 – 100 15 Difference in percent that counts as a scene change.
Block (X/Y) blockx / blocky – 32 / 32 Block size of the metrics.

Other groups

Example

Default settings on an 8-bit YUV 4:2:0 telecined source (1920x1080, 29.97 fps, detected as top field first):

clip2clip = clip
clip2clip = qtgmc.QTGMC(Input=clip2clip, Preset="fast", tools={'mv': 'mvutensils', 'expr': 'akarin', 'nnedi3': 'znedi3', 'eedi3': 'vszip', 'dfttest': 'neo_fft', 'nlmeans': 'knlm', 'bm3d': 'bm3d', 'rg': 'zsmooth', 'median': 'zsmooth', 'fft3d': 'neo_fft', 'grain': 'noise'}, TFF=True, FPSDivisor=2)
clip = core.vivtc.VFM(clip, order=1)
# VDecimate helper function 
def postprocess(n, f, clip, deinterlaced):
  if f.props['_Combed'] > 0:
    return deinterlaced
  else:
    return clip
clip = core.std.FrameEval(clip=clip, eval=functools.partial(postprocess, clip=clip, deinterlaced=clip2clip), prop_src=clip)
clip = core.vivtc.VDecimate(clip) # new fps: 23.976
# Making sure content is perceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # scan type: progressive

How Hybrid calls it

  • Field order: follows the source (detected scan type or Overwrite input scan type); VFM reads the field order property Hybrid sets after the source.
  • The helper deinterlacer runs at the source rate (QTGMC or NNEDI3); for every frame VFM marks as combed its frame is used instead.
  • For every format other than 8-bit YUV 4:2:0 Hybrid matches on an 8-bit 4:2:0 copy and takes the pixels from the original; chroma comb detection is then switched off.
  • Decimation: VDecimate gives input rate × (1 − 1/Cycle), e.g. 29.97 → 23.976 fps. Fix Telecined Fades and Fix combed run afterwards.
  • Afterwards the clip counts as progressive. The frame size must be a multiple of 4.

Background

VIVTC is maintained in the VapourSynth project's own repository and was derived from TIVTC's TFM and TDecimate with fewer options. VFM writes match, combing and scene change information to the frame properties; VDecimate can also override decisions or do a dry run, which Hybrid does not use. For the more configurable original see TIVTC.

Sources