AfterDawn.com

MPEG-2 Basics

The MPEG-2 video format is heavily used by DVD, SVCD, and standard definition digital satellite and CATV services. MPEG-2 is primarily a destination format (ie DVD, SVCD) because the way it's compressed makes it difficult to edit without reducing quality by requiring some re-encoding, not to mention complications arising if the video is interlaced.

Profiles

MPEG-2 encoding is organized into profiles. Each profile defines a range of settings for different encoder options. Most settings aren't available in all profiles. Profiles are intended to match encoder settings with consumer electronics settings. A home video or mobile device will use hardware rated for a particular profile, allowing you to encode to the same settings. This guide will primarily be intended for Main Profile, although differences for Simple Profile will also be discussed. Higher profiles aren't available in consumer MPEG-2 encoders.

Levels

Within each profile are multiple levels with reduced restrictions as you rise from Low Level to Main Level or Main Level to High Level. The combination of profile and level is noted as Profile@Level where both are often given abbreviations. Simple and Main Profiles give us six possible levels; Simple Profile@Low Level (SP@LL), Simple Profile@Main Level (SP@ML), Main Profile@Main Level (MP@ML), Main Profile@High 1440 (MP@H-14), and Main Profile@High Level (MP@HL). Of these, most encoding at the time of publication is done for MP@ML devices like DVD players. At some point the balance may switch to a hi-def choice like MP@HL, although MPEG-4 is generally considered a better format to use for HD video transmission. Most encoders, once again as of the publication of this guide, only support up to MP@ML.

Frame Details

Many specific details about MPEG-2 frames are determined by the profile and level




Profile@LevelMax ResolutionMax FramerateMax BitrateFrame Type
SP@LL176x14415fps96kbpsProgressive Only
SP@ML352x28815fps384kbpsProgressive Only
320x24024fps
MP@LL352x28830fps4MbpsProgressive and Interlaced
MP@ML720x57625fps15MbpsProgressive and Interlaced
720x48030fps
MP@H-141440x108030fps60MbpsProgressive and Interlaced
1280x72060fps
MP@HL1920x108030fps80MbpsProgressive and Interlaced
1280x72060fps


Colorspace

MPEG-2 Main and Simple profiles use a variation of YUV called YV12. YV12 is a planar colorspace, meaning the Y, U, and V components are each on a separate plane (layer) with the . The chroma (U and V) is reduced to 1 pixel per 2x2 block of luma (Y) pixels. Chroma pixels are actually in spatially different locations than all luma pixels, putting them at the intersection of a 4 pixel block. An MPEG decoder will have to determine the values to apply to each luma pixel based on comparisons between adjacent chroma pixels.

DCT Precision

Like most still image formats, MPEG video uses Discrete Cosine Transforms to compress each image by approximating the color values of blocks of pixels. A The amount of precision used to calculate the approximations determines how close the detail is to the original, and to some extent the file size. Less precision is accomplished by using fewer bits, resulting in somewhat smaller files. MPEG-2 files may use between 8 and 11 bits, although DVD only allows up to 10 bits. If you're re-encoding an MPEG-2 file to a new MPEG-2 file, it's best to find the DCT precision of the original since there's no point in exceeding it in the new encode.

Interframe Compression

In order to get much higher compression rates than intraframe compression (within a frame) would allow, GOPs are used to compress by removing redundant information between frames. Frames that aren't complete pictures don't need to store information that hasn't changed.

MPEG-2 GOP structure is composed of I, P, and B frames. I frames are the largest of the three, being complete images used for keyframes, although I frames can also be found in the middle of some GOPs. P frames are significantly smaller than I frames, and depend on I frame data. B frames, which aren't available in Simple Profile, are even smaller than P frames, but rely on I and P frames both before and after them. This means an MPEG decoder capable of decoding Main Profile has to decode I and P frames before any B frames that rely on them.

Typical GOPs have one I frame followed by 3 or more P frames. Immediately following each I or P frame are two B frames. Specific destination formats may have rules regarding GOP structure or length. For example, PAL DVD-Video may not have GOPs longer than 15 frames, while NTSC DVD-Video may use up to 18. Less common GOP variations include the use of additional I frames that aren't keyframes. This allows a small space savings as more frames are written between GOP headers. Realistically this doesn't save much space, and is very uncommon.

Closed GOPs

Normally GOPs are open, meaning frames from one GOP can require frames from another GOP to be decoded properly. Optionally, GOPs can be closed, meaning they don't rely on any frames from another GOP. This is commonly done for ILVU on DVDs - a subject for another guide.

Bitrate

The maximum bitrate for Main Profile MPEG-2 video is 15Mbps, although specific formats will typically set their own limitations. DVD, for example, allows no more than 9.8Mbps - often less. A second bitrate, called the mux_rate, is sometimes cited specifications for standalone formats. A file's mux_rate is the combined bitrate of all streams. For a file with multiple audio or other content streams this would mean totaling them and adding the video bitrate. MPEG-2

VBR

The size taken up by video can always be calculating it's bitrate. The higher the bitrate, the more space it needs. In order to improve compression while allowing complex video to attain high bitrates MPEG-2 video can range from very low to very high bitrates, sometimes allowing very low bitrates to yield surprisingly high quality video. The real key to VBR encoding is that the average can be set to any number you want, assuming you're within the restrictions of your destination format and capailities of your encoder. There are sometimes limitations on how well hardware handles large variations in bitrate variation that interfere with optimal bitrate distribution.

previous  | next

Table of Contents

  1. 1. Introduction
  2. 2. MPEG-2 Basics
  3. 3. Other Details
Written by: Rich Fiscus