Vapoursynth TFM

From wiki.selur.net
Jump to navigation Jump to search

TFM (from TIVTC) is a field matcher: for every frame it chooses the field pairing that rebuilds a progressive picture from telecined or field-shifted material, and it can deinterlace frames that remain combed.

Filtering → Vapoursynth → Frame → Misc

TFM controls in Hybrid
TFM controls in Hybrid

What it does

TFM compares the current frame's field with the fields of the previous and next frames and keeps the best match. Frames that are still combed afterwards can be post-processed (deinterlaced). Hybrid uses TFM without decimation, so the frame rate stays the same; add TDecimate to get back to 24p, or use TIVTC for both steps. Hybrid switches TFM on automatically for field-shifted sources.

Settings

Control Parameter Range / values Hybrid default Meaning
Mode mode 0 – 7 1 (2-way match + 3rd match on combed) Which matches are tried: 0 = 2-way (p/c), safest and fastest; higher modes try more matches and are more aggressive; 6 = mode 2 (p/c + u) plus extra matches; 7 = field switching for a special blended pattern (needs linear access).
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 of the whole frame, 5–7 = motion-adaptive blend / cubic / ELA.
FM Speed slow normal, slower, slowest slower Speed and accuracy of the field match metric.
MChroma mChroma on/off on Includes chroma in the match decision.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# Field matching using TFM
clip = core.tivtc.TFM(clip)

How Hybrid calls it

  • TFM works on 8–16-bit integer YUV 4:2:0, 4:2:2 or 4:4:4 with even dimensions; other formats are converted first.
  • No field order is passed: TFM reads it from the clip's field order property.
  • Options are only written when they differ from the defaults (Hybrid's defaults are the plugin's).
  • With PP 2 – 7 Hybrid treats the result as progressive (deinterlaced). With PP 0 or 1 combed frames stay untouched (PP 1 only flags them), so Hybrid keeps treating the stream as interlaced.
  • Frame count and frame rate do not change.

Background

Not exposed

The plugin has many more options – field, combing thresholds (cthresh, MI), excluded rows, scene threshold, overrides and more – which Hybrid does not offer. It writes the chosen match, the field and combing information to the frame properties.

Sources