AfterDawn.com

Other Details

MPEG files and their contents follow a few guidelines. In order to understand those guidelines it's necessary to understand the basics of streams. Files with combined video and audio data are said to have video and audio streams. Those streams can be extracted into separate files which would be considered elementary streams. Combined in one file they're muxed (multiplexed) streams.

MPEG Files

MPEG-2 files follow generally follow certain naming conventions that are designed around use on Windows systems. Normally an elementary MPEG-2 video stream ends with an extension of .m2v or sometimes .mpv while an elementary audio stream (MPEG-2 layer II) will typically have an extension of .mpa or .mp2. Muxed (combined video and audio) files normally have an extension of .mpeg. Sometimes .mpg is used instead, but that's more commonly reserved for MPEG-1 files.

MPEG Audio

The only audio that's official for MPEG-2 files is MPEG-2 layer II. Valid sample rates, in kiloHertz, are 16, 22.05, 24, 32, 44.1, and 48. Bitrates range from 8kbps to 384kbps. Although MPEG-2 layer II audio is capable of relatively high quality for a lossy encoding process, lack of consistent hardware support for it has rendered it nearly irrelevant in terms of standalone player support.

Foreign Streams

One place MPEG-2 shines as a standard is support for alternative streams. Applications like DVD require the ability to use streams that aren't actually part of the MPEG-2 standard (like Dolby Digital audio and bitmap subpictures). Fortunately the MPEG-2 standard allows Foreign Streams to be muxed with MPEG-2 video without losing standards compliance. This is why a DVD's VOB files are legal MPEG-2 files as well.

Editing MPEG-2 Files

Because MPEG-2 is made of frames that depend on other frames to display correctly , it's a poor format to encode video in that you plan to edit later. If you need to do very basic editing (removing or joining frames) there are a few editors on the market that can do the job with very little quality loss in the surrounding frames, but anything more risks more loss than may be acceptable. Lossless formats like HuffYUV or those with no interframe compression like MJPEG are generally considered the best choice for editing.

Other MPEG Tools

Besides cutting and joining clips, MPEG tools can make many changes simply by changing data in the MPEG headers. The headers in MPEG files contain information like framerate, resolution, aspect ratio, and maximum bitrate. By changing these, or other bits of information in the headers, subtle changes can be made to how video is displayed. Since the video data isn't changed, simply editing headers is a completely lossless process.

RFF

The Repeat Field Flag is one of the most useful features of MPEG-2. It can be used to duplicate fields to create the same pattern used to display movies on NTSC televisions. This allows the original film frames to be encoded in the video stream, and RFF or Pulldown flags added afterward to tell the decoder to display particular fields more than once.

Program vs Transport Streams

There are two standard types of multiplexed MPEG-2 files. Program Streams are multiplexed MPEG-2 files intended for applications where error correction is possible and expected. This includes DVD, and generally any application where optical media is used for delivery. Transport Streams are intended for delivery across unreliable media. It's the best method for delivering real-time MPEG-2 across broadcast or satellite or streaming across the internet (not something MPEG-2 is well suited for).

When you're encoding you'll probably be creating program streams. If you're working with MPEG-2 files as sources you may be starting with transport streams. When working with these files you'll sometimes find a much higher error rate than you would in program streams. There are a few tools, some free and some commercial, that can "fix" these files and at least attempt to hide the errors.


Return to Removing Commercials from MPEG-2 captures with Cuttermaran



Version History

v1.0 2007.08.31 by Rich Fiscus
v1.0.1 2007.09.05 Screenshots updated by Rich Fiscus
v1.0.2 2007.11.16 Added links to additional DVF guides by Rich Fiscus
previous

Table of Contents

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