Deinterlace Field-Matching Frames with FFmpeg Yadif
This guide explains how to properly configure the yadif
(Yet Another DeInterlacing Filter) filter in FFmpeg to handle residual
combing left behind by field matching. When performing inverse telecine
(IVTC) on mixed or telecined video, simple field matching can leave
stray interlaced artifacts. By setting yadif to selectively
deinterlace only frames flagged as combed, you can maintain maximum
image sharpness on progressive frames while cleaning up remaining
interlacing.
The Inverse Telecine Pipeline
When reversing telecine, the standard approach is to first pair
fields back into full progressive frames using the
fieldmatch filter. However, field matching cannot cleanly
resolve scene changes, mixed content, or broken cadences, resulting in
combed frames.
To resolve this, fieldmatch analyzes the stream and
metadata-tags any unresolved frames as interlaced. You then pass this
stream into yadif with its conditional deinterlacing
parameter enabled, followed by decimate to remove duplicate
frames.
The Command
Run the following command in your terminal:
ffmpeg -i input.ts -vf "fieldmatch=order=auto:combpel=80,yadif=mode=0:parity=-1:deint=1,decimate" -c:v libx264 -crf 18 -c:a copy output.mp4Parameter Breakdown
fieldmatch=order=auto:combpel=80: Matches complementary fields across adjacent frames to reconstruct the original progressive picture.order=auto: Automatically detects whether the source is Top Field First (TFF) or Bottom Field First (BFF).combpel=80: The pixel threshold used to detect combing artifacts. If combed artifacts exceed this threshold,fieldmatchmarks the frame's metadata as interlaced.
yadif=mode=0:parity=-1:deint=1: The deinterlacing stage.mode=0: Outputs one progressive frame for each frame input (maintaining frame rate, rather than bobbing to double frame rate).parity=-1: Automatically inherits the field parity detected by upstream filters.deint=1(ordeint=interlaced): This is the key parameter. Instead of filtering every frame—which would needlessly soften progressive frames—it tellsyadifto only process frames thatfieldmatchmarked as interlaced. Clean frames pass through untouched.
decimate: Drops the redundant 1-in-5 frames created by 3:2 pulldown removal, successfully returning a 29.97 fps telecined stream to its native 23.976 fps.
Fine-Tuning Comb Detection
If you notice lingering combed lines that yadif missed,
fieldmatch failed to flag the frame. You can make comb
detection more sensitive by adjusting the fieldmatch
parameters:
-vf "fieldmatch=combpel=40:cthresh=9,yadif=deint=1,decimate"Lowering combpel (the comb pixel threshold) and
cthresh (the area combing threshold) forces
fieldmatch to be more aggressive, triggering
yadif on subtle combing at the expense of potentially
processing clean frames.