Sunday, October 17, 2010

Camcorders and Interlaced vs. Progressive Video

My Canon FS100 camcorder records video in the funky MOD file format, making the video files rather difficult to work with using standard software. I recently spent some time trying to figure out a better way to deal with these files and learned a few things about video formats that I thought I'd write down to possibly save someone else time.

Why are the FS100's MOD files hard to work with?

MOD files from the FS100 basically have MPEG-2 video with AC3 audio, which works great for burning to a DVD. However, I mostly want to share the videos on sites like YouTube, for which purpose the MOD files are problematic in two ways: (1) the aspect ratio of the video is not marked properly within the file (fairly easy to fix), and (2) the videos are interlaced (a bigger problem).

What is interlaced video?

Wikipedia explains things pretty well. Basically, in interlaced video, only half the horizontal lines are recorded / drawn in each frame (odd lines in one frame, even lines in the next). This technique saves significant bandwidth compared to progressive scan video (which records every line in each frame) without much (any?) quality loss on older CRT TVs. But, interlaced video looks terrible on LCD TVs and computer monitors (which are progressive displays) due to combing artifacts.

How does one convert the FS100's interlaced videos to progressive?

Apparently, deinterlacing a video is a really hard problem. The best free solution I've found is HandBrake; see their deinterlacing guide. In the process of deinterlacing, I also re-encode the video as MPEG-4. It would be nice to avoid this re-encoding, but the need to deinterlace makes it pretty much necessary (VLC can deinterlace video during playback, but you have to enable it manually, and most players don't have this feature).

What to DVDs and DVD players do about this interlaced vs. progressive issue?

DVDs almost always hold interlaced video. For video from a television source, no conversion is needed. For film sources, conversion to interlaced video is usually accomplished as part of 2-3 pulldown (aka 3:2 pulldown), which also serves to fix the frame rate mismatch between film (24 progressive fps) and NTSC video (60 interlaced fps). David Bordwell wrote a fascinating post on this topic a while back.

A progressive scan DVD player outputs a progressive signal on those outputs that support it (e.g., HDMI). For film sources, the original progressive frames should be recoverable if the proper MPEG-2 flags were used on the DVD, though 2-3 pulldown is still necessary if the display is 60Hz. For television sources, algorithmic de-interlacing must be performed.

Note that for displays with a refresh rate that is a multiple of 24 (e.g., 120Hz), it's possible to "undo" the 2-3 pulldown (known as reverse telecine) and simply repeat each frame a constant number of times to match the display's refresh rate, removing some artifacts.

120Hz / 240Hz LCDs are supposed to reduce motion artifacts for sports, etc. How does this work when the input signal is 60fps, e.g., a TV broadcast?

Since there aren't any additional frames in the input signal to display, these TVs typically reduce artifacts by interpolating new frames or by darkening the display between frames.