Here’s another fun (?) aspect of MPEG. As mentioned last post, TV (at least in the US) isn’t really 30 frames per second: it’s 60 half-frames per second, where half of the time it shows the odd-numbered lines and half of the time it shows the even-numbered lines. (This is called interlacing.) Since MPEG both wants to play on TVs and wants to be able to encode TV programs, it of course has methods for encoding interlaced content. There are two basic ways to do this: in one, called field pictures, each picture only includes half the data. In the other, called frame pictures, each picture includes complete data, but you can indicate that you want the two halves of the picture displayed at different times, and (if so) which half to display first. (Or you can indicate that you don’t want the two halves displayed at different times; a good TV will support this.) In my experience, frame pictures are used much more frequently than field pictures; I’m not sure why (and, for that matter, I also don’t know if my experience is representative).

But that’s not all there is to the story. Recall that movie content is 24 frames per second. So what’s the best way to play this on a TV? If you think of a TV as being 30 frames per second, then you should probably just display every fourth frame twice. But if you think of a TV as being 60 half-frames per second, then it gets more interesting: you want to divide 24 full frames into 60 half-frames. So, on average, you want to spread each full frame of the movie over 2.5 half-frames on your TV. Now, of course, you can’t actually do that, but maybe you can have the movie frames alternate between taking 3 half-frames and 2 half-frames.

And MPEG has a bit just to support this: repeat_first_frame. If this bit is set on a (full) frame, then the first half of the frame gets played twice. So frames are encoded like this:

  1. repeat_first_frame set, top_field_first set: display this movie frame as Top, Bottom, Top.
  2. repeat_first_frame not set, top_field_first not set: display this movie frame as Bottom, Top.
  3. repeat_first_frame set, top_field_first not set: display this movie frame as Bottom, Top, Bottom.
  4. repeat_first_frame not set, top_field_first set: display this movie frame as Top, Bottom.
  5. Start over.

This is known as 3-2 pulldown. DVD players and TVs will advertise themselves as having special circuitry to detect this case, so they can display it as smoothly as possible.

Of course, it’s still more complicated than this – you can control interlacing both via the progressive_frame bit (in one header) and via the progressive_sequence bit (in another header), and the latter changes the meanings of various other bits. Lots to learn about.

Post Revisions:

There are no revisions for this post.