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.
0orsend_frame: Outputs one frame for each frame. This is the standard deinterlacing mode, resulting in the original frame rate (e.g., 30i becomes 30p).1orsend_field: Outputs one frame for each field. This doubles the frame rate (e.g., 30i becomes 60p), preserving the full temporal resolution of the original video and producing smoother motion.2orsend_frame_nospatial: Like0, but skips spatial interlacing checks.3orsend_field_nospatial: Like1, but skips spatial interlacing checks.
2. Parity (Field Dominance)
The parity parameter specifies which field is dominant
(comes first) in the interlaced input.
0ortff: Top Field First.1orbff: Bottom Field First.-1orauto: Automatically detects the field dominance from the input metadata (Default).
3. Deint (Selective Deinterlacing)
The deint parameter controls which frames are processed
by the filter.
0orall: Deinterlaces every frame in the video stream (Default).1orinterlaced: Only deinterlaces frames that are flagged as interlaced in the container metadata.
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.mp4Example 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.mp4Example 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