Interlace and Deinterlacing

Why do I care what interlace is? You my dear friend care because it can make your nice finished video look terrible on computers, flat panel displays, and projectors if you don’t handle if correctly.

What is interlace anyway? Without getting into the long and illustrious history of interlace, interlace comes from cameras that shoot video at 2 fields per frame. Great, what does that mean? It means that for each frame of video, 2 pictures are taken, each one 1/2 the vertical resolution of the frame, for standard definition that is 480 pixels. So each field is 720 pixels wide, and 240 pixels tall. These 2 fields comprise a frame by alternating horizontal lines between field one and field two. There are some great pictures and more a more in depth look at Wikipedia here. Interlace looks great on CRT monitors because of the way that the phosphors slowly fade away instead of immediately turning off like they do on LCDs, Plasmas, and DLPs. Right there is the problem, a lot of people have non-CRT displays, including all computers (computers just don’t support interlace at all), and when they view interlaced video they either see all of the alternating lines, or if their display is deinterlacing it for them, they see a lot of jaggies along the edges of objects and text. To see this download VLC, a free media player, and pop in a DVD. By default it does not deinterlace.

Interlace is also used in a special way to record 24 frame material to 29.97 frame video. This is called 3:2 pulldown. You do not want to deinterlace this kind of video and I will cover how to get progressive frames from this kind of video in a future post.

It is 2007 at the time of this writing, and interlace is still around on brand new cameras. Why? One, because camera manufacturers have tons of interlace technology and experience and two, because it is more difficult to move progressive frames around, it takes more memory, bandwidth and processing power to deal with them, so it is cheaper for the camera manufacturers to stick with good old interlace. Even with the new fancy HDV cameras that are out, a lot of them still only support interlaced formats, most commonly 1080i. This is frustrating and problematic for end users. So what do we do with this interlaced material? Well, you can just leave it interlaced, and when you play it back on flat panels and projectors they will deinterlace it internally. The problem with the internal deinterlacers on most displays is that they are crap. They use the least processor intensive method of deinterlacing, which is going to make your footage look very aliased. Aliasing is when the edges of objects are not smooth and organic, but instead are jagged and sharp. All deinterlacing is going to create some aliasing, but more processor intensive methods will minimize it. Displays have to deinterlace in real-time, so they require a lot of processing very quickly. With software we have the benefit of being able to use more processor intensive methods and simply wait for the result.

So, if you want to play your interlaced projects on non-CRT displays I recommend a good long deinterlacing beforehand. I use After Effects for this, but any compositor will do a good job. Final Cut Pro and Premiere can also do it, but will give you less control, and generally worse results.

The first step is the same as I laid out in the Upconversion article, you can skip ahead if you read that one and understand where I am going. First thing you need is to get your project onto your computer. I’m assuming that has already happened for editing purposes. You need to export your project from your editing app to one uncompressed file. Do not export a DV file, export a 10 or 8 bit uncompressed mov or avi. If you have the disk space choose 10-bit, it will look slightly better.

I should mention before going on that if you have created any titles or effects it would be best if you turned all of those off before exporting your video. After deinterlacing the text will become very aliased, and any effects will become soft and less accurate. After the deinterlace you can add the titles and effects to the deinterlaced version with much higher quality results.

After you’ve made your huge video file fire up After Effects and import it into your new project. You are only going to be working with this one file, so just drag in onto the create new composition button at the bottom of the project window, it looks like a tiny pixelized film frame. This will create a composition matching your file’s length and format. This next step requires that you have After Effects Pro. Under the File menu choose Project Settings, and under Color Settings choose 16 bits per channel, or if you are really anal choose 32. This setting change saves your color information from being wrecked during the deinterlace. If left in 8 bit your colors and contrast will be really degraded. It is important to make sure not to use any effects in this project that do not support 16 or 32 bit processing, as it will make your colors and contrast really wonky. You can tell that an effect does not support a higher bit-depth when it shows a small little triangle next to its name in the effects window.

You are now ready to deinterlace. Right-click on your file in the Project pane and under Interpret Footage choose Main… and a dialog box will pop-up. We are interested in the Separate Fields drop down box. There are 2 options Upper Field First and Lower Field First, which are referring to the field dominance of the video. As we learned earlier interlaced video is made up of 2 fields per frame. Field dominance states whether the upper field, the field whose first horizontal line is the first line of video in a frame, or the lower field, whose first horizontal line is the second line of video in a frame, is the first field in a frame. In other words an Upper Field First frame is made up of one Upper Field followed by one Lower Field, and a Lower Field First frame is made up of one Lower Field followed by one Upper Field. For the brave of heart there is more information here. All you really need to know is that DV video is Lower Field First and HDV video is Upper Field First. So choose the setting that corresponds with your project and hit OK. Amazingly that is about it. You just have to render it out now.

Again the next steps are virtually the same as in the Upconversion article.

Ideally you will want to render out an uncompressed file, add your titles and effects again and then encode to whatever playback file you will need, be it WM9, h.264, Blu-ray, etc. You will need a good amount of disk space though. An 8-bit SD file will be about 113GB for 90 minutes and 144GB for 10-bit and an 8-bit uncompressed 1080 30p file will take around 550GB for 90 minutes, 10-bit will be around 700GB, but none of the above encoding formats support 10-bit so there really isn’t much point in creating a 10-bit file unless you are going to output to a Digibeta, HDCAM SR or D5. Note: Regular HDCAM is only 8-bit.

To render out your nice deinterlaced video choose Add to Render Queue in the Composition menu, and the render queue tab will be selected with your composition in it. In the Render Settings you want to make sure that Quality is at Best, Resolution is at Full, and that your frame rate is correct. In the Output Module you want to select your uncompressed mov, avi, or image sequence. And finally under Output To you want to select the directory where you want to save your file in. The last thing you have to do is hit the Render button and then wait.

On my dual dual-core Opteron PC it takes around 8 hours to render in HD and 3 for SD per 90 minutes with Gridiron Nucleo installed. Nucleo is a great plugin if you have multiple cores and/or processors. I can’t recommend it enough. Check it out at http://www.gridironsoftware.com/. I have heard that the new After Effects CS3 has better multi-processor support, so Nucleo may not continue to be amazing, but for the time being it is. Regardless of how fast your machine is, just make sure you have enough disk space and enough time to render and go relax, have a sandwich, go to bed, and let your computer do all of the heavy lifting.