How to Use the w3fdif Filter in FFmpeg

This guide explains how to use the w3fdif (Weston 3-Field Deinterlacing Filter) in FFmpeg to convert interlaced video into progressive video. You will learn the basic syntax, the primary parameters of the filter, and practical command-line examples to achieve high-quality deinterlacing in your video processing workflows.

What is the w3fdif Filter?

The w3fdif filter is an advanced deinterlacer in FFmpeg based on the Weston 3-field deinterlacing algorithm. It interpolates missing lines in interlaced fields by analyzing three consecutive fields of video. This filter is highly regarded for producing smooth motion and sharp details, making it an excellent alternative to other deinterlacers like yadif or bwdif.

By default, w3fdif outputs one progressive frame for each input field, which effectively doubles the frame rate (e.g., 60i becomes 60p).

Basic Syntax

To use the filter, apply it to your video stream using the -vf (video filter) flag:

ffmpeg -i input.mp4 -vf w3fdif output.mp4

This basic command applies the filter using its default settings, which provides a balance of high quality and standard processing speed.

Key Parameters

You can customize the behavior of w3fdif by passing specific parameters in a key-value format: w3fdif=parameter1=value1:parameter2=value2.

Practical Examples

1. High-Quality Deinterlacing (Default)

This command uses the complex filter and maximum quality settings to double the frame rate of the output video.

ffmpeg -i input.ts -vf w3fdif -c:a copy output.mp4

2. Fast Deinterlacing

If processing speed is a priority (for example, in real-time streaming), use the simple filter configuration:

ffmpeg -i input.ts -vf w3fdif=filter=simple -c:a copy output.mp4

3. Deinterlacing Interlaced-Tagged Frames Only

To avoid processing frames that are already progressive, configure the filter to only deinterlace flagged content:

ffmpeg -i input.ts -vf w3fdif=deint=interlaced -c:a copy output.mp4

4. Adjusting Speed and Quality

To slightly speed up the encoding process while still using the complex filter, you can set the speed parameter to a higher value:

ffmpeg -i input.ts -vf w3fdif=filter=complex:speed=1 -c:a copy output.mp4