FFmpeg Yadif Filter Guide: Custom Deinterlacing Modes

This guide explains how to use the yadif (Yet Another Deinterlacing Filter) in FFmpeg to convert interlaced video into progressive format. You will learn the syntax of the filter, the specific behaviors of its custom configuration modes, and how to apply practical command-line options to control frame rates, field dominance, and selective deinterlacing.

Understanding the Yadif Filter Syntax

The basic syntax for the yadif filter in FFmpeg is structured as follows:

-vf "yadif=mode:parity:deint"

You can specify these parameters by their position or by explicitly naming them (e.g., yadif=mode=1:parity=0:deint=0).


Custom Parameters and Modes

To customize the deinterlacing process, you can configure three key parameters: mode, parity, and deint.

1. Mode (Frame Rate and Spatial/Temporal Prediction)

The mode parameter determines how many frames are output and whether spatial interlacing checks are performed.

2. Parity (Field Dominance)

The parity parameter specifies which field is dominant (comes first) in the interlaced input.

3. Deint (Selective Deinterlacing)

The deint parameter controls which frames are processed by the filter.


Practical Command Examples

Here is how to apply these modes in standard FFmpeg commands.

Example 1: Standard Deinterlacing (Preserve Frame Rate)

If you want to deinterlace an interlaced file (e.g., 1080i50 to 1080p25) while keeping the default frame rate, use mode=0:

ffmpeg -i input.mp4 -vf "yadif=mode=0:parity=-1:deint=0" -c:v libx264 -crf 20 -c:a copy output.mp4

Example 2: Bob Deinterlacing (Double Frame Rate / Smoother Motion)

To convert interlaced footage to a high-frame-rate progressive format (e.g., 1080i50 to 1080p50) to keep fluid motion, use mode=1:

ffmpeg -i input.mp4 -vf "yadif=mode=1:parity=-1:deint=0" -c:v libx264 -crf 20 -c:a copy output.mp4

Example 3: Forced Top Field First (TFF) Deinterlacing

If your video file is improperly tagged but you know it uses Top Field First dominance, you can manually set parity=0:

ffmpeg -i input.mp4 -vf "yadif=mode=0:parity=0:deint=0" -c:v libx264 -crf 20 -c:a copy output.mp4