Deinterlacing

From VideoLAN Wiki
Revision as of 21:24, 2 May 2011 by Technologicat (talk | contribs) (Added telecine info, added algorithm classification, added info on new algorithms in v1.2.0+)
Jump to navigation Jump to search

Deinterlacing is the process of converting source material that contains alternating half-pictures to a computer screen that displays a full picture at a time.

Description

Traditional TVs do not display one picture-frame at a time. Instead, they display alternately all the odd lines and all the even lines of the picture. That way, they can get a fast display rate of 50 or 60 half-pictures per second, without the bandwidth requirements that full pictures have.

Computers however, do display full pictures, typically at a rate of at least 60 pictures per second. So to get optimum quality when displaying TV-material (such as DVDs) on a computer, the player can convert the alternating half-pictures to full pictures. That is called deinterlacing.

Modern HDTVs operate much like computers in that they display full pictures. Much like computer-based video players, they have deinterlacing built in so that they can display traditional TV material.

A very good description of the problem and the various ways of deinterlacing can be found at 100fps.com.

VLC settings

VLC has deinterlacing disabled by default. You can enable it for the current video by using the menus or right-clicking. Also, by default the key D during playback switches deinterlacing on and off (using the mode selected in the Preferences; see below).

To change the settings, go to the Video section in the Simple Preferences. You can choose from On, Automatic or Off. The recommended choice is Automatic. VLC will then check the stream flags (technical term for information embedded in the video) and automatically set deinterlacing on or off, depending on if the current video is marked as interlaced. If the setting is On, VLC will apply deinterlacing even if the original is not interlaced (which is a really bad idea). The setting Off, respectively, always keeps deinterlacing off.

In All Preferences, these settings can be found in Preferences/Video/Filters. The mode, and in v1.2.0+ also some extra settings, are available in Preferences/Video/Filters/Deinterlace.

The keyboard shortcut can be configured in the Hotkeys section of the Simple Preferences. Its name is Cycle deinterlace modes.

Interlaced or telecined?

In addition to true interlaced signals, there exists also a process called telecine which produces interlacing. It is a type of artificial interlacing that may be added to sources that were originally progressive. Telecine produces a characteristic look, with a repeating sequence of 3 progressive frames followed by 2 artificially interlaced frames.

Why would anyone want to do that? The answer lies in different framerates, and in transfer of film sources to television and video. Film is commonly shot at 24 pictures per second, while NTSC television and video equipment operates at 60 half-pictures per second. Telecine inserts extra half-pictures so that films can be stored in the NTSC format (for example on DVDs in Japan and USA).

For more on telecine, see for example the following links [1] [2] [3] [4]. (Caution: the Wikipedia page does not mention anime as of April 2011.)

Which type of interlacing do I have?

This depends on the format (PAL, NTSC) and the content of the source. PAL is used in Europe and Australia, NTSC in USA and Japan. This also applies to the DVDs produced in those regions.

Live-action movies in the PAL format typically are not interlaced at all. This is because it is easier to transfer film to PAL than to NTSC.

Home movies shot on a camcorder are typically true interlaced.

Telecine is very common in Asia and especially in Japan. Anything originating in Asia is likely to be telecined. For example, with very few exceptions, all anime in the NTSC format is telecined. This includes the corresponding North American releases.

Source material that was converted from a different format is a special case. Producing a correct transfer for pure video material from NTSC to PAL or vice versa is very difficult due to the differences in framerate and number of lines. Whether a deinterlacer is needed depends on the details of the transfer. In the particular case of anime, a PAL conversion usually spells disaster for deinterlacing; see [5].

Algorithm types

In VLC, there are several deinterlacing algorithms to choose from. This section presents a general classification. Skip ahead for an individual description of each mode.

Algorithms available from a specific VLC version onward are marked with Name(vx.y.z+).

Doublers

VLC modes: Bob, Linear, Yadif (2x), Phosphor(v1.2.0+)

These algorithms display the video at the original half-picture rate, which is typically 50 (PAL) or 60 (NTSC) half-pictures per second. This is double the full picture rate, hence the name. This approach to deinterlacing is also known as field rendering.

This group takes into account that the half-pictures of a true interlaced video were intended to be displayed at different times. This can make the motion look very smooth.

Simple doublers (Bob and Linear) display only one half-picture at a time. Nevertheless, the quick alternating display produces a convincing illusion of full vertical resolution while playback is running.

Some more advanced doublers (such as Yadif (2x)) are based on interpolators (see below), and attempt to generate full pictures to display. When interpolators are used in this way, which field is kept, alternates just like in the simple doublers.

The last doubler (Phosphor) does not fit into either of these categories, but attempts to simulate a traditional CRT TV.

All doublers can be used with both true interlaced and telecined video.

Interpolators

VLC modes: X, Yadif, (Discard)

These algorithms analyze the picture, detecting progressive and interlaced parts. Typically the progressive parts of the picture are passed through unchanged, although in some algorithms various kinds of filtering may be used.

For the interlaced parts, one half-picture is kept, while the other is generated out of thin air with various mathematical methods, based on the information in one or both of the original half-pictures.

The Discard algorithm is a degenerate case of this type, which does not analyze the picture. It simply keeps one half-picture and discards the other one.

The output runs at the full-picture rate, which is typically 25 (PAL) or 30 (NTSC) pictures per second. The different intended display times for the half-pictures in a true interlaced video are ignored.

Interpolators are designed for use with true interlaced video only. They will stutter if applied to telecined video.

Some doublers exist, such as Yadif (2x), which are based on interpolators. These hybrid algorithms behave like doublers (see above). They may be able to improve the picture quality compared to simple doublers, at the cost of more CPU cycles (requiring a faster processor).

Blenders

VLC modes: Mean, Blend

These algorithms mix information from both half-pictures to produce a blended (mixed) full picture. This is simple and removes interlacing, but causes ghostlike trails for fast motion.

The output runs at the full-picture rate, which is typically 25 (PAL) or 30 (NTSC) pictures per second. The different intended display times for the half-pictures in a true interlaced video are ignored.

Blenders are designed for use with true interlaced video only, and will stutter with telecined video.

Inverse telecine

VLC modes: IVTC(v1.2.0+)

This group of algorithms is specifically designed for removing telecine from NTSC telecined video. Inverse telecine is also known as IVTC, film mode and 3:2 reverse pulldown.

Inverse telecine algorithms try to extract the original progressive film frames and to display them at the original framerate (24 pictures per second). In the ideal case, this perfectly restores the progressive signal. There is no loss of information and no need to generate anything out of thin air.

Due to practical reasons, these algorithms are always based on analyzing the picture. They are not and cannot be perfectly accurate, but in practice they work well for most telecined sources.


VLC deinterlace modes

VLC has the following deinterlace modes. Refer to 100fps.com for illustrations. VLC does not have anything like what 100fps.com calls Motion blur, Hybrid, and Motion compensation.

Disabled

This is what 100fps.com calls "do nothing". Other names: "weave" or "no deinterlacing". Should be used for PsF ([6]) content.

Blend

Blender (full resolution). Each line of the picture is created as the average of a line from the odd and a line from the even half-pictures. This ignores the fact that they are supposed to be displayed at different times.

Bob

Doubler. Display each half-picture like a full picture, by simply displaying each line twice. Preserves temporal resolution of interlaced video.

Discard

Only display one of the half-pictures, discard the other. Other name: "single field". Both temporal and vertical spatial resolutions are halved. Can be used for slower computers or to give interlaced video movie-like look with characteristic judder.

Linear

Doubler. Bob with linear interpolation: instead of displaying each line twice, line 2 is created as the average of line 1 and 3, etc.

Mean

Blender (half resolution). Display a half-picture that is created as the average of the two original half-pictures.

X

Interpolator. Generates a full picture taking the odd lines from the odd half-picture, and creating the even lines through a complicated algorithm (involving ME, MC, edge-oriented interpolation) that uses information from both half-pictures.

This is similar to what 100fps.com calls Area based.

Yadif

Interpolator. The Yet Another DeInterlacing Filter from the MPlayer project. Generates a full picture taking the odd lines from the odd half-picture, and creating the even lines through a complicated algorithm that includes both temporal and spatial interpolation.

Yadif (2x)

Doubler. Bob with Yadif interpolation. Caution: Very heavy on the CPU.

Phosphor (v1.2.0+)

Doubler. This filter attempts to simulate the rendering mechanism of a traditional CRT TV. The latest two half-pictures are displayed, the old one fading out. The strength of the fade effect can be configured in All Preferences, see Video > Filters > Deinterlace.

IVTC (v1.2.0+)

Inverse telecine. Removes telecine from NTSC telecined video in realtime, losslessly recovering the progressive signal. Note: Only applicable to telecined sources. Particularly useful for NTSC anime DVDs.


Resulting framerate and resolution

In the table below, Fps is how often VLC will update the picture on your monitor. Half is 25 or 30 times per second, while full is 50 or 60 times.

Picture lines is how many lines there is in the picture that VLC generates. Half equals the number of lines in a half-picture, while full is twice as many. That picture will be scaled before being displayed, so this just tells us how detailed the picture could potentially be.

Method Fps Picture lines
Disabled half? full
Blend half full
Bob full half/full (note 1)
Discard half half
Linear full half/full (note 1)
Mean half half
X half full
Yadif half full
Yadif (2x) full full\half (note 1)

Note 1: Bob converts the half-pictures to full-pictures by simply showing each line twice; so while the full number of lines are displayed, the true resolution is only half. The same goes for linear, though it's a bit smarter about the process.

Recommendation

"Linear" is probably the best compromise from the algorithms that VLC implements.

Disclaimer

Please update this page if it contains any errors or when it goes out of date.