How to Deinterlace Video Using FFmpeg bwdif
Deinterlacing is essential for converting legacy interlaced video
formats into progressive frames suitable for modern screens. This guide
provides a straightforward walkthrough on how to use FFmpeg’s advanced
bwdif (Bob Weaver Deinterlacing Filter) filter, detailing
its custom parameters—such as mode, parity, and deinterlacing target—to
help you achieve optimal video output quality.
Understanding the bwdif Filter
The bwdif filter is a high-quality, motion-adaptive
deinterlacer based on the Yadif (Yet Another Deinterlacing Filter)
algorithm, but it incorporates complex spatial-temporal interpolation
from the Bob Weaver algorithm to deliver sharper and more accurate
results.
To use bwdif, you pass it to FFmpeg’s video filter flag
(-vf). The basic syntax is:
-vf "bwdif=mode=MODE:parity=PARITY:deint=DEINT"Custom Parameters for bwdif
You can customize the bwdif filter using three primary
parameters: mode, parity, and
deint.
1. mode (Deinterlacing Mode)
Controls how many output frames are generated relative to the input
fields. * 0 (or send_frame):
Outputs 1 progressive frame for each input frame (standard frame rate).
* 1 (or send_field): Outputs
1 progressive frame for each input field, which doubles the frame rate
(often called “bobbing”). This preserves smooth motion. *
2 (or send_frame_nospatial):
Similar to mode 0, but skips spatial interlacing check. *
3 (or send_field_nospatial):
Similar to mode 1, but skips spatial interlacing check.
2. parity (Field Dominance)
Specifies which field comes first in the interlaced source. *
0 (or tff): Top Field First.
* 1 (or bff): Bottom Field
First. * -1 (or auto):
Automatically detects the field dominance from the input metadata
(Recommended).
3. deint (Deinterlacing Target)
Determines which frames should be processed. * 0
(or all): Deinterlaces all frames in the video
stream. * 1 (or interlaced):
Only deinterlaces frames that are explicitly flagged as interlaced in
the metadata.
Practical Examples
Example 1: High-Frame-Rate Deinterlacing (Recommended for Smooth Motion)
This command outputs one progressive frame per field (doubling the frame rate from 30fps to 60fps, for example) and automatically detects field parity.
ffmpeg -i input.mp4 -vf "bwdif=mode=1:parity=-1:deint=0" -c:v libx264 -crf 18 -c:a copy output.mp4Example 2: Same-Frame-Rate Deinterlacing with Forced Top Field First
This command maintains the source video’s original frame rate (one frame per frame) and forces the deinterlacer to treat the input as Top Field First.
ffmpeg -i input.mp4 -vf "bwdif=mode=0:parity=0:deint=0" -c:v libx264 -crf 18 -c:a copy output.mp4Example 3: Selective Deinterlacing (Metadata-Dependent)
This command only deinterlaces frames marked as interlaced, leaving progressive frames untouched.
ffmpeg -i input.mp4 -vf "bwdif=mode=1:parity=-1:deint=1" -c:v libx264 -crf 18 -c:a copy output.mp4