Vapoursynth TIVTC

From wiki.selur.net
Revision as of 11:13, 16 November 2026 by Selur (talk | contribs) (TFM defaults now match the plugin (9 / 12) (via update-page on MediaWiki MCP Server))
Jump to navigation Jump to search

TIVTC is the inverse telecine pair TFM + TDecimate: TFM matches fields to rebuild the progressive frames of telecined video, TDecimate then removes the duplicates (one in five for NTSC film, or down to any target rate). It can also handle sources that mix film and video.

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

TIVTC controls in Hybrid
TIVTC controls in Hybrid

What it does

For every frame TFM picks the field pairing with the least combing; frames that stay combed are post-processed (deinterlaced), either by TFM itself or with frames from a helper deinterlacer. TDecimate compares neighboring frames and drops the most similar ones per cycle, or decimates to an arbitrary rate. Both filters are also available on their own: TFM and TDecimate.

Settings

The page has the tabs Base, Advanced and Misc. Options are only written when they differ from Hybrid's defaults unless noted.

TFM

Control Parameter Range / values Hybrid default Meaning
Deinterlacer clip2 inner, QTGMC fast / medium / slow / Very Slow, nnedi3 inner Source of the replacement frames for combed frames: TFM's own post-processing, or a same-rate QTGMC or NNEDI3 clip.
Mode mode 0 – 7 1 (2-way match + 3rd match on combed) Which matches are tried; higher modes try more and are more aggressive.
PP PP 0 – 7 6 (motion-adaptive cubic) Post-processing: 0 = no combing check, 1 = only flag combed frames, 2–4 = blend / cubic / ELA deinterlacing, 5–7 = motion-adaptive blend / cubic / ELA.
MThresh mthresh 0 – 100 5 Motion threshold of the motion-adaptive post-processing (PP 5–7).
FM Speed slow normal, slower, slowest slower Speed and accuracy of the match metric.
MChroma mChroma on/off on Include chroma in the match decision.
Mic match micmatching 0 – 3 1 How the combing values (mics) are used to override match decisions.
Scene threshold scthresh 0 – 100 12 Scene change threshold in percent (the plugin default); always written.
U/B, Mic match (sco) ubsco, mmsco on/off on / on When on, u/b matches and mic-based match changes are only used at scene changes.
y0 / y1 y0, y1 0 – 8192 0 / 0 Rows excluded from the match decision (e.g. subtitles); off when equal.
Metric metric 0 – 1 0 Combing metric.
Block (X/Y) blockx / blocky 4 – 2048 16 / 16 Block size of the combed-frame detection.
Chroma threshold cthresh −1 – 255 5 Combing threshold (8-bit scale), not a chroma setting; always written (plugin default 9).
Chroma chroma on/off off Include chroma in the combed-frame detection.
MI MI up to Block X × Block Y 80 Combed pixels in one block above which a frame counts as combed.

TDecimate

Control Parameter Range / values Hybrid default Meaning
Mode mode 0, 1, 2, 7 0 0: drop the most similar frames per cycle; 1: drop from the longest duplicate runs; 2: arbitrary rate; 7: arbitrary rate by thresholds.
Cycle / CycleR cycle, cycleR 2 – 100 / 1 – 50 5 / 1 Per Cycle frames, CycleR frames are dropped (modes 0/1).
Hybrid hybrid no handling, blend 30p→24p keep 24p, blend 24p→30p keep 30p no handling Handling of mixed film/video material (modes 0/1, CycleR 1; Cycle and CycleR are then fixed at 5 and 1).
VidDetect / ConCycle vidDetect, conCycle A … A and (B or C) / 1 – 2 A and B / 1 Tests that mark a cycle as video, and how many cycles in a row must be video (Hybrid handling only).
SDLim sdlim −10 – 10 0 Minimum distance between two dropped frames (CycleR above 1).
DupThresh dupThresh 0 – 100 1.1 (mode 1), 0.4 (mode 7) Difference in percent below which a frame counts as a duplicate; used in modes 1 and 7 and always written there. Changing the mode sets the plugin's default for that mode.
VidThresh vidThresh 0 – 100 1.1 (3.5 in mode 7) Difference above which a frame counts as video (mode 7 and Hybrid handling).
SceneThresh sceneThresh 0 – 100 15 Difference that counts as a scene change (mode 7 and Hybrid handling).
Rate rate fraction 24000/1001 Target frame rate (modes 2/7).
Max ndl maxndl 0 – 99 0 Largest number of non-duplicates in a row (mode 2; 0 = not written, the plugin decides).
m2PA m2PA on/off off Mode 2 analyzes the whole cycle ahead; slow at cycle starts.
Duplicate thresh (check box + value) nt 0 – 10 off, 0 Noise threshold: differences below it are ignored when frames are compared.
Block (X/Y), Chroma, Denoise, SSD, Display blockx/blocky, chroma, denoise, ssd, display – 32/32, on, off, off, off Metric block size, chroma in the metrics, denoising before the metrics, squared differences, and printing the metrics onto the frame.

Other groups

  • Fix Telecined Fades: a separate group with its own settings, see Fix Telecined Fades.
  • Tools: implementations for the QTGMC or NNEDI3 helper clip.

Example

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

# Deinterlacing using TIVTC
clip = core.tivtc.TFM(clip, scthresh=19.00, cthresh=5)
clip = core.tivtc.TDecimate(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: TFM reads it from the field order property Hybrid sets after the source (detected scan type or Overwrite input scan type). The NNEDI3 helper uses the same order; the QTGMC helper runs at the source rate.
  • Decimation and frame rate: modes 0/1 give input rate × (Cycle − CycleR) / Cycle (29.97 → 23.976 fps with 5/1); "blend 30p→24p" gives 4/5 of the input rate, "blend 24p→30p" keeps the input rate; modes 2/7 give the Rate fraction, which Hybrid also sets exactly on the output.
  • Afterwards the clip counts as progressive.
  • Works on 8–16-bit YUV 4:2:0, 4:2:2 and 4:4:4; RGB is converted to YUV 4:4:4 first. Thresholds are on the 8-bit scale or percentages and do not need bit-depth scaling.

Background

TIVTC is tritical's AviSynth package; the VapourSynth plugin is dubhater's port. In the port TFM takes the field order from the clip's frame property and stops with an error if it is missing. For the TDecimate options see also TDecimate; VapourSynth's own derivative is VIVTC.

Sources