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:qpThe filter accepts three optional parameters, separated by colons:
- 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).
- parity: Specifies the field parity of the input
video.
0: Bottom Field First (BFF).1: Top Field First (TFF).-1: Automatic detection (default).
- 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.mp4For 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.mp4Important Considerations
- Processing Speed: Because motion-compensated
deinterlacing is computationally heavy, encoding speeds will drop
significantly compared to simpler filters like
yadiforbwdif. - Dependency on Snow Codec: The
mcdeintfilter relies internally on the Snow codec’s motion estimation. Because the Snow codec is deprecated in some modern FFmpeg distributions, you may need to ensure your FFmpeg build supports it, or useyadifas a fallback ifmcdeintthrows an initialization error.