Spatial-Temporal Deinterlacing in FFmpeg with mcdeint

This guide explains how to configure and apply the mcdeint (motion-compensating deinterlace) filter in FFmpeg to eliminate interlacing artifacts from video sources. It covers the required filterchain syntax, explains the primary parameters for controlling quality and performance, addresses modern compatibility considerations, and details efficient alternative filters for spatial-temporal processing.

How the mcdeint Filter Works

The mcdeint filter evaluates motion between adjacent fields across both space and time to reconstruct progressive frames. Unlike simple spatial deinterlacers that interpolate missing lines within a single field, motion-compensated deinterlacing tracks pixel movement across consecutive fields to preserve high-frequency edge detail without introducing heavy blurring or comb artifacts.

Because mcdeint uses motion estimation algorithms originally derived from the Snow codec, it requires an initial deinterlacing pass to generate the base frames for motion analysis. It is almost always paired sequentially with a filter like yadif (Yet Another Deinterlacing Filter).

Applying mcdeint in an FFmpeg Command

To use mcdeint, construct a video filter graph (-vf) placing yadif before mcdeint.

ffmpeg -i input_interlaced.ts -vf "yadif=0:-1:1,mcdeint=mode=fast:parity=tff:qp=1" -c:v libx264 -preset slow -crf 18 -c:a copy output_progressive.mp4

Parameter Breakdown

  • yadif=0:-1:1:
    • 0: Outputs one progressive frame per frame (no frame doubling).
    • -1: Automatically detects field parity.
    • 1: Deinterlaces only frames marked as interlaced.
  • mcdeint options:
    • mode: Controls motion estimation thoroughness. Available values are fast, medium, slow, and extra_slow. Higher modes yield better reconstruction around fast motion but significantly reduce encoding speed.
    • parity: Sets field dominance. Use tff for top-field-first material (common in 1080i broadcasts) or bff for bottom-field-first material (common in standard-definition DV). If omitted, it attempts auto-detection.
    • qp: Quantization parameter used internally for motion estimation. A value of 1 prioritizes precision.

Compatibility and Performance Notes

The mcdeint filter is one of the most computationally demanding deinterlacers in FFmpeg. It operates strictly on the CPU and does not scale well across high core counts. Additionally, because it depends on legacy motion-estimation code, several modern FFmpeg distributions and minimal builds disable or omit mcdeint by default.

If your FFmpeg binary does not support mcdeint or if encoding speed is a limiting factor, two modern alternatives provide comparable or superior spatial-temporal quality:

1. bwdif (Bob Weaver Deinterlacing Filter)

bwdif is an advanced, motion-adaptive spatial-temporal filter that checks cubic interpolation against both previous and next fields:

ffmpeg -i input_interlaced.ts -vf "bwdif=mode=0:parity=-1:deint=1" -c:v libx264 -crf 18 -c:a copy output.mp4
  • Use mode=0 for one frame per frame, or mode=1 for bob deinterlacing (50/60 progressive frames per second from 50i/60i content).

2. nnedi3

For complex edge preservation without ghosting artifacts, the neural-network-directed nnedi filter computes spatial interpolations with exceptional precision:

ffmpeg -i input_interlaced.ts -vf "nnedi=weights=nnedi3_weights.bin:deint=1" -c:v libx264 -crf 18 -c:a copy output.mp4