MPEG Package


Package Name

DvmMpeg

Description

Dali supports reading and processing of MPEG-1 Video, Audio and System. Currently, only Video encoding is supported.

MPEG Video

The format of MPEG-1 Video is as follows. A MPEG-1 Video starts with arbitrary number of bytes, followed by a sequence header, followed by zero, one or more alternating sequence of GOP(Group of Pictures) header and GOPs, followed by a sequence end marker. A GOP is an series of pictures (frames) each of which consists of a picture header and the actual picture data. A picture can be of type I (intracoded), P (predicted) or B (bidirectional-predicted). Each GOP must have at least one I frame.

Dalì provides abstraction for each of these headers : MpegSeqHdr, MpegGopHdr and MpegPicHdr. Each header type supports the following basic primitives : find, dump, skip, parse, encode. A picture is decoded into three ScImages and zero (I), one (P) or two (B) VectorImages.

To encode an MPEG-1 Video sequence, convert each RGB image frame to YUV ByteImages; perform a motion vector search on the Y ByteImage (for P and B frames); compress the ByteImages to ScImages; and finally encode the ScImages into a Bitstream.

Dali provides support for frame extraction through the use of an MpegVideoIndex abstraction. An MpegVideoIndex is used to store information about each frame. Frame type, length, number of reference frame (0 for I, 1 for P, or 2 for B), and the offsets needed to get to these frames.

MPEG Audio

MPEG-1 Audio is sequence of frames. Each frame has a header and body. The body encodes some number samples for current frame. Samples from the next few frames can also be encoded in the current frame if space permits.

We have four main abstractions for MPEG-1 Audio File. One for the mpeg audio header (MpegAudioHdr), and the other three for the encoded audio frames (one for each layer of encoding: MpegAudioL1, MpegAudioL2, MpegAudioL3). The audio frame abstraction for layer 1 and layer 2 contain compressed data for one channel of audio. For layer 3 stereo audio, since encoding of left and right channels depend on each other, the audio data contains compressed data for both channels.

The encoding of each audio frames depends on the previous frames. To store these dependencies, we have two auxilary structures : MpegSynData and MpegGraData. Each corresponds to the dependencies of a channel from an audio stream, and is updated during each decoding. This makes direct access into the middle of the streams impossible at the moment. Note : We can still have direct access, provided that we precompute these dependencies and store them in files. But this feature is not available right now.

MPEG System

A MPEG-1 System stream is a multiplex of videos and audios. It consists of a sequence of packets, each one contains raw compressed data from one of the streams. Dalì provides abstractions for all three header structures that exists in MPEG-1 System streams:   system header, pack header, and packet header. Dalì also allows creation of a MpegSysToc, a table-of-content structure that stores offset and length of each packet, and the timestamp from each packet.

Detailed Specification

MPEG Video

Tcl specification
C API specification

MPEG Audio

Tcl specification
C API specification

MPEG System

Tcl specification
C API specification

Dependencies

Needs DvmBasic, DvmColor, DvmPnm

Example

Convert a MPEG-1 video to series of PPM images. [ tcl | C ]
Random access to MPEG-1 Video using MpegVideoIndex [ tcl | C ]
Convert a MPEG-1 Audio to a PCM file. [ tcl | C ]
Demultiplex a MPEG-1 System Streams to seperate stream (using MpegSysToc) [ tcl | C ]
Demultiplex a MPEG-1 System Streams to seperate stream (using Find/Parse) [ tcl | C ]
Encoding an MPEG-1 Video from a series of PPM Files (I and P Frame only). [ tcl | C ]
Encoding an MPEG-1 Video from a series of PPM Files (I,P,B with half-pel motion estimation) [ tcl | C ]


Last Updated :

Copyright © 1997-1998 by Cornell University. See the file license.txt for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.