Vapoursynth ITM

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

ITM is field matching with the IT plugin, a port of the AviSynth IT inverse telecine filter: for each frame it picks the field combination that gives a progressive picture and deinterlaces frames that stay combed.

Filtering → Vapoursynth → Frame → Misc

ITM controls in Hybrid
ITM controls in Hybrid

What it does

Telecined or field-shifted video mixes fields of different film frames. ITM looks at the neighboring fields and chooses the pairing that rebuilds a clean progressive frame; frames that remain combed are deinterlaced by interpolating one field. With fps 30 (default) IT only matches fields: no frames are removed and the frame rate stays the same; a decimator such as TDecimate can follow. With fps 24 IT also removes one frame in five and returns to the film rate. See also IT on the Deinterlace/Telecine tab.

Settings

Control Parameter Range / values Hybrid default Meaning
fps fps 24, 30 30 30 = field matching only, 24 = field matching and decimation to 4/5 of the rate.
Threshold threshold 0 – 100000 20 Sensitivity of the field match decision; lower is more aggressive.
/ (second box) pthreshold 0 – 100000 75 Threshold for classifying a frame as progressive or combed.

Example

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

clip = core.std.AddBorders(clip=clip, left=0, right=0, top=6, bottom=6) # add borders to achieve mod 16 (vsITM) - 640x368
# Field matching using (z)IT
clip = core.zit.IT(clip, fps=30) # new fps: 25
clip = core.std.Crop(clip=clip, left=0, right=0, top=6, bottom=6) # removing added borders from mod requirement (vsITM) -  640x356

How Hybrid calls it

  • ITM works on 8–16-bit integer YUV; the frame width must be a multiple of 16.
  • The field order comes from the detected scan type, or from Overwrite input scan type: bottom field first sources are matched with reference BOTTOM; top field first and unknown orders use TOP, the plugin default.
  • fps is always written; the thresholds only when they differ from the defaults.
  • Afterwards Hybrid treats the clip as progressive.
  • With fps 30 frame count and frame rate do not change; with fps 24 the rate becomes 4/5 of the input (29.97 → 23.976 fps), and Hybrid tracks it.

Background

The IT plugin

The plugin used is zit, a port of VapourSynth-IT with all AviSynth parameters restored. It supports 4:2:0, 4:2:2 and 4:4:4 at 8–16 bit, widths up to 8192 (multiple of 16) and even heights (multiple of 4 for 4:2:0). With fps 24 it decimates to 4/5 of the rate; with fps 30 it only matches fields. Its deinterlacing of leftover combed frames defaults to one-field interpolation; it writes progressive, combed and diagnostic frame properties.

Sources