How to Use the mcdeint Filter in FFmpeg

The mcdeint (motion-compensated deinterlacing) filter in FFmpeg is a powerful tool designed to clean up interlaced video footage by analyzing motion between fields. This article provides a straightforward guide on how to implement the mcdeint filter, explains its essential parameters, and shares practical command-line examples to help you achieve high-quality deinterlaced output.

Understanding the mcdeint Filter

The mcdeint filter uses motion estimation to reconstruct interlaced frames into progressive ones. Because it evaluates how pixels move across frames, it produces much cleaner edges and fewer artifacts than standard spatial deinterlacers. However, it is highly CPU-intensive and requires a build of FFmpeg compiled with GPL support.

Syntax and Parameters

The basic syntax for applying the filter in your video filter chain (-vf) is:

-vf mcdeint=mode:parity:qp

The filter accepts three optional parameters, separated by colons:

  1. mode: Specifies the processing mode.
    • 0: Fast (performs basic deinterlacing).
    • 1: Medium (balances quality and speed).
    • 2: Slow/Extra effort (uses motion estimation for the highest quality).
  2. parity: Specifies the field parity of the input video.
    • 0: Bottom Field First (BFF).
    • 1: Top Field First (TFF).
    • -1: Automatic detection (default).
  3. qp: Quantization parameter. A higher value leads to a smoother motion vector field but may result in more blurred details. The default is 1.

Practical Command Examples

To apply the mcdeint filter with default settings (automatic parity detection, medium speed, and default QP), use the following command:

ffmpeg -i input.mp4 -vf mcdeint=1:-1:1 output.mp4

For the highest possible quality deinterlacing on a video known to be Top Field First (TFF), set the mode to 2 and parity to 1:

ffmpeg -i input.mp4 -vf mcdeint=2:1:1 output.mp4

Important Considerations