wiki:DeinterlacingGuide

Deinterlacing Guide


Quick start

You can tell if something is interlaced by testing with your eyes.

To check, click the Preview Window button on the toolbar and glance at the preview frame. You can use the slider bar to scrub through the movie (frames are evenly spaced at every 10% of the video). If it's not quite clear if the frames are interlaced or not, enable deinterlacing. To do this, click the Picture Settings button on the toolbar. Select the tab button for Filters. There is a slider which toggles between deinterlacing and decoming. Make sure it's on deinterlacing. Then, select a method from the "Deinterlace" pop-up menu. If the picture noticeably improves, leave Deinterlacing enabled. When previewing still frames, the only method applied is "Fast," so don't be concerned if you can't tell the difference between it and Slow and Slower. You will see it in the output. "Fast" is fine for checking whether or not content should be deinterlaced.

https://handbrake.fr/help/interlacinganimlf6.gif (The screenshot is from an old version of HandBrake, but the principle is still the same -- just with a pop-up menu instead of a checkbox, in an inspector instead of a sheet.)

What is interlacing?

Back in the day, when the Powers That Be were setting the rules for over-the-air TV, they needed a way to compress the video to fit it in the radio waves. This was back before fancy computers with H.264 encoders and other assorted digital compression mumbo-jumbo. So, instead, they went with an analog approach: update the image twice as often, but only send half as much content.

Ever had a bright line shined in your eye, and then the after-image stuck in your field of vision for a few moments? Interlacing works on the same principle.

Instead of dividing video into 30 frames, interlaced video is divided into 60 fields. Each of those fields is half as tall as a frame, and lasts half as long on screen. The fields are spaced out, and alternate, so that when they're shown fast enough, the first field hasn't faded from the eye when the second field appears. This persistence of vision creates the illusion of a moving picture at full resolution.

Why should I care?

Interlacing only looks right on an old tube TV (Cathode Ray Tube, or CRT).

If you have an LCD or a plasma, interlaced content looks horrible.

Deinterlacing in HandBrake

To turn on deinterlacing in the MacGui, select an item from the "Deinterlace" pop-up menu in the Picture Settings inspector's Filter tab (if it isn't visible, toggle the slider that selects between deinterlacing and decombing). In the CLI, use the --deinterlace flag.

HandBrake offers several different deinterlacing methods.

HandBrake's traditional deinterlacer, "Fast", is a simple linear filter. It averages together a column of pixels above and below the current one being filtered. In this average, it weighs down the value of pixels from the "bad" field being filtered away to practically nothing, while boosting up the value of pixels from the "good" field being preserved. The end result looks little better than simply line doubling, with jagged lines along any diagonals or curves. In fact, it can look a little worse than line doubling. Because the alternate field is suppressed but not entirely eliminated, it's sometimes possible to see its ghost in the output, as it subtly changes color and brightness to reveal the outline of an object that shouldn't be on screen until the next frame.

This is why HandBrake now offers a better method of deinterlacing, developed for the MPlayer project (the yadif filter). This new method does not have the problems "Fast" has. There should be fewer issues with jagged lines and no ghosting.

"Slow" looks to frames before or after to figure out which pixels to base its guesses on. Then, when it guesses, it tries to follow edges in the current frame. This means sometimes, instead of guessing based on a vertical column of pixels the way "Fast" always does, it will follow diagonals, sampling pixels that are, say, to the lower left and upper right of the current pixel. Most of the time, this will be good enough, and it should look better than "Fast."

"Slower" goes a bit further, and looks to frames before or after again, to tweak its guesses based on what it knows of the previous and next moments in time.

Decomb

HandBrake now offers a new filter, called Decomb, that can be used instead of Deinterlace. It uses yadif in "Slower" mode, but only selectively.

Deinterlacing is a blunt weapon, and it should only be applied when it's absolutely necessary. It can also be tedious to discover whether or not a source is interlaced. And even when it is, interlacing is only visually apparent through combing artifacts. Those tell-tale horizontal lines only appear when things are in motion. But regular deinterlacing is applied to every frame without fail. This slows it down.

Decomb only deinterlaces frames that are visibly interlaced. This saves time, and makes it safe, usually, to leave it on all the time. It won't destroy the detail in progressive sources the way Deinterlace will, and should be faster than "Slow" or "Slower".

Last modified 22 months ago Last modified on 11/02/14 20:09:01