How to Use the FFmpeg bwdif Filter
This guide provides a quick and practical overview of how to use the
bwdif (Bob Weaver Deinterlacing Filter) in FFmpeg. You will
learn what the filter does, how its primary parameters work, and how to
apply it to your videos using straightforward command-line examples to
achieve high-quality deinterlacing.
What is bwdif?
The bwdif filter is a motion-adaptive deinterlacing
algorithm based on the “Bob Weaver” method. It is highly regarded in the
FFmpeg community because it often produces sharper results with fewer
visual artifacts than older filters like yadif.
Basic Syntax
To use bwdif in FFmpeg, you apply it via the video
filter flag (-vf). The basic syntax is:
-vf "bwdif=mode=value:parity=value:deint=value"Key Parameters
mode: Controls the frame rate of the output video.0(orsend_frame): Outputs one frame for each frame. This keeps the original frame rate (e.g., 30i becomes 30p).1(orsend_field): Outputs one frame for each field. This doubles the frame rate (e.g., 30i becomes 60p), resulting in much smoother motion. This is the default.
parity: Specifies the field dominance (which field comes first).0(ortff): Top Field First.1(orbff): Bottom Field First.-1(orauto): Automatically detects the field dominance (default).
deint: Determines which frames to deinterlace.0(orall): Deinterlace all frames (default).1(orinterlaced): Only deinterlace frames that are flagged as interlaced.
Practical Examples
Example 1: Standard Deinterlacing (Double Frame Rate)
By default, bwdif uses mode=1, which
outputs a progressive frame for every field (bobbing). This is ideal for
fast-moving content like sports because it preserves the fluid motion of
the original interlaced video.
ffmpeg -i input.mp4 -vf "bwdif" output.mp4Example 2: Keep Original Frame Rate
If you want to keep the original frame rate (e.g., converting 29.97i
to 29.97p), set the mode to 0.
ffmpeg -i input.mp4 -vf "bwdif=mode=0" output.mp4Example 3: Specifying Field Order Manually
If automatic detection fails and your output video has a jittery motion, you can manually specify the field dominance. For Top Field First (TFF) files, use:
ffmpeg -i input.mp4 -vf "bwdif=mode=1:parity=0" output.mp4For Bottom Field First (BFF) files, use:
ffmpeg -i input.mp4 -vf "bwdif=mode=1:parity=1" output.mp4