ffmpegvideo-filterdeinterlaceyadifbwdifbucket-doc

FFmpeg Deinterlace Video: yadif and bwdif Filter Guide

·Javid Jamae·6 min read
FFmpeg Deinterlace Video: yadif and bwdif Filter Guide

Interlaced video is one of those problems you don't think about until it ruins your output. You're processing broadcast recordings, digitizing old tapes, or ingesting capture card footage, and suddenly your output has those ugly horizontal combing lines across every frame with motion. The fix is deinterlacing, and FFmpeg gives you two solid filters for it: yadif and bwdif.

TL;DR: Use ffmpeg -i input.mp4 -vf "yadif" output.mp4 for fast deinterlacing. Use bwdif instead of yadif when you need better edge quality and don't mind the extra processing time.

What Interlacing Actually Is

Interlaced video stores each frame as two fields: odd-numbered scan lines in one field, even-numbered lines in the next. Old CRT TVs painted these fields alternately, which looked smooth. Modern progressive displays show all lines at once, so those two fields from slightly different moments in time create visible combing artifacts on anything that moved between fields.

You'll hit interlaced content from broadcast TV recordings (DVB, ATSC), DV and HDV cameras, capture cards pulling from HDMI or SDI sources, and archival footage from tape digitization workflows.

Deinterlacing with the yadif Filter

yadif (Yet Another DeInterlacing Filter) is FFmpeg's workhorse deinterlacer. It's fast, handles most content well, and has been stable for years.

Basic usage:

ffmpeg -i interlaced.mp4 -vf "yadif" progressive.mp4

That's the simplest form. yadif has three parameters you can tune:

yadif=mode:parity:deint
  • mode controls output frame rate. 0 sends one frame per input frame (default). 1 sends one frame per field, doubling your frame rate.
  • parity sets the field order. -1 is auto-detect (default and usually correct). 0 forces top-field-first (TFF). 1 forces bottom-field-first (BFF).
  • deint controls which frames get deinterlaced. 0 deinterlaces all frames (default). 1 only deinterlaces frames that FFmpeg flags as interlaced.

Double the frame rate (field-per-frame mode):

ffmpeg -i interlaced.mp4 -vf "yadif=1:-1:0" smooth-60fps.mp4

This converts 30i content to 60p. You get smoother motion because each field becomes its own frame, but your file size roughly doubles.

Only deinterlace flagged frames:

ffmpeg -i mixed.mp4 -vf "yadif=0:-1:1" output.mp4

Useful for mixed content where some sections are progressive and others are interlaced. Leaves the progressive frames untouched.

Deinterlacing with the bwdif Filter

bwdif (Bob Weaver Deinterlacing Filter) uses a more sophisticated interpolation algorithm than yadif. It produces cleaner edges and fewer artifacts on fine detail, at the cost of more CPU time.

Basic usage:

ffmpeg -i interlaced.mp4 -vf "bwdif" progressive.mp4

bwdif takes the same three parameters as yadif:

ffmpeg -i interlaced.mp4 -vf "bwdif=1:-1:0" smooth-output.mp4

If you're processing archival footage where quality matters more than speed, bwdif is the better choice. For high-volume automated pipelines where you're processing hundreds of files, yadif's speed advantage usually wins.

Detecting Interlaced Content with idet

Before deinterlacing, it helps to know if your video is actually interlaced. FFmpeg's idet filter analyzes frames and reports what it finds:

ffmpeg -i input.mp4 -vf "idet" -f null - 2>&1 | grep "Multi frame"

Output looks like this:

[Parsed_idet_0 @ 0x...] Multi frame detection: TFF:  312 BFF:    0 Progressive:   18 Undetermined:    2

TFF and BFF counts tell you the content is interlaced and which field order it uses. Progressive means those frames don't need deinterlacing. If you see mostly progressive frames, skip the deinterlace step entirely.

yadif vs bwdif: When to Use Which

Factoryadifbwdif
SpeedFaster (about 2x)Slower
Edge qualityGoodBetter on fine detail
Motion handlingSolidSlightly smoother
Best forBatch processing, automationArchival, quality-critical
Parametersmode, parity, deintmode, parity, deint (identical)

For most automated video pipelines, yadif is the right default. Switch to bwdif when you're doing archival digitization or when someone has flagged combing artifacts in yadif output.

Deinterlacing via the FFmpeg Micro API

If you don't want to install FFmpeg or manage servers, you can deinterlace through the FFmpeg Micro API with a single HTTP call:

yadif:

curl -X POST https://api.ffmpeg-micro.com/v1/transcodes \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": [{"url": "https://example.com/interlaced-video.mp4"}],
    "outputFormat": "mp4",
    "options": [
      {"option": "-vf", "argument": "yadif"}
    ]
  }'

bwdif with field-per-frame output:

curl -X POST https://api.ffmpeg-micro.com/v1/transcodes \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": [{"url": "https://example.com/interlaced-video.mp4"}],
    "outputFormat": "mp4",
    "options": [
      {"option": "-vf", "argument": "bwdif=1:-1:0"}
    ]
  }'

The API handles the infrastructure. You get back a job ID, poll for completion, and download the progressive output.

Common Pitfalls

  • Deinterlacing progressive video. Running yadif or bwdif on content that's already progressive wastes time and can slightly degrade quality. Use idet first.
  • Wrong field order. If parity is set wrong, you'll see judder instead of smooth motion. Leave it at -1 (auto) unless you have a specific reason to force it.
  • Forgetting frame rate changes in mode 1. Field-per-frame mode doubles your frame rate. Downstream tools expecting 30fps will break if they get 60fps. Set -r 30 after the filter if you need to maintain the original rate.
  • Double-deinterlacing. Some source files have already been (poorly) deinterlaced. Running another pass doesn't fix the original artifacts and can introduce new ones.

FAQ

How do I know if my video is interlaced?

Run ffmpeg -i input.mp4 -vf "idet" -f null - and check the Multi frame detection line. If TFF or BFF counts are high, the video is interlaced. You can also check with ffprobe -show_streams input.mp4 and look for field_order=tt or field_order=bb.

Is bwdif always better than yadif?

Not always. bwdif produces cleaner edges on fine detail, but the difference is subtle on most content. yadif runs roughly twice as fast. For batch processing hundreds of files, yadif's speed advantage matters more than the marginal quality gain.

Can I deinterlace and compress in one pass?

Yes. Chain the deinterlace filter with encoding options:

ffmpeg -i interlaced.mp4 -vf "yadif" -c:v libx264 -crf 23 -preset medium output.mp4

What about w3fdif or kerndeint?

w3fdif (W3FDIF) is another option that's slower but handles some edge cases better. kerndeint is deprecated and shouldn't be used. For most workflows, yadif and bwdif cover everything you need.

FFmpeg Micro handles deinterlacing in the cloud with zero setup. Get a free API key and process your first video in under a minute.

About Javid Jamae

Founder & CEO at FFmpeg Micro

Javid is a software engineer, author, and entrepreneur with over 25 years of professional software development experience across enterprise, startup, and consulting environments. He founded FFmpeg Micro to make video processing accessible to developers through a simple, automation-first REST API.

Software EngineeringVideo ProcessingFFmpegCloud ArchitectureAPI DesignAutomation

Ready to process videos at scale?

Start using FFmpeg Micro's simple API today. No infrastructure required.

Get Started Free