Vapoursynth VFM

From wiki.selur.net
Revision as of 09:53, 16 November 2026 by Selur (talk | contribs) (New filter page (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

VFM (from VIVTC, a rewrite of TIVTC's TFM) is a field matcher: it rebuilds progressive frames from telecined or field-shifted video by picking the best matching field for each frame.

Filtering → Vapoursynth → Frame → Misc

VFM controls in Hybrid
VFM controls in Hybrid

What it does

For every frame VFM compares the possible field pairings and keeps the one with the least combing. It does not remove frames and does no deinterlacing itself; frames that are still combed are only marked as combed. To get back to the film rate, use VIVTC (VFM + VDecimate); for a matcher with built-in post-processing see TFM.

Settings

Control Parameter Range / values Hybrid default Meaning
Field field 0 – 3 2 Field to match from: 0 = bottom, 1 = top, 2 = same as the field order, 3 = opposite of the field order.
Mode mode 0 – 5 1 (p/c + n) Which matches are tried; higher modes try more matches.
Chroma matching mchroma on/off on Includes chroma in the match decision.
Chroma threshold cthresh −1 – 255 9 Combing detection threshold (8-bit scale).
Mi mi 0 – Block X × Block Y 80 Number of combed pixels inside one block (Block X × Y) above which a frame counts as combed.
Chroma comb detection chroma on/off on Includes chroma in the combing detection; only used for 8-bit YUV 4:2:0 input, for other formats Hybrid writes chroma=False.
Block (X/Y) blockx / blocky 4, 8, … 512 16 / 16 Block size of the combing detection.
Exclude y0 / y1 0 – 64 / 16 – 64 16 / 16 Rows from y0 to y1 are left out of the combing detection; equal values = off.
Scene threshold scthresh 0 – 100 12 Scene change threshold in percent.
Mic match micmatch 0 – 2 1 How the combing values (mics) are used for the match decision.
Mic out micout on/off off Writes the combing values of all matches to the frame properties.

Example

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

# Field matching using VFM
yv12=core.resize.Bicubic(clip=clip,format=vs.YUV420P8, range_in_s="limited")
# Forcing chroma to False for VFM
clip = core.vivtc.VFM(yv12, clip2=clip, order=1, chroma=False)

How Hybrid calls it

  • VFM decides on an 8-bit YUV 4:2:0 copy of the clip; if the clip has another format, the matches are applied to the original clip, so the output keeps its format. Width and height must be multiples of 4.
  • The field order (order) follows the field order of the source (detected or overwritten scan type): bottom field first only for a BFF stream, otherwise top field first. It is always written; the other options only when they differ from the defaults (Hybrid's defaults are the plugin's).
  • Afterwards Hybrid treats the clip as progressive.
  • Frame count and frame rate do not change.

Background

Frame properties

VFM marks its output as progressive and writes the combed flag, the chosen match, the combing values and a scene change flag to the frame properties; a following decimator such as VDecimate can use them.

Sources