Media Concepts
Valid for: CANoe DE • CANoe4SW DE Parts taken from the MSDN online library.Streams
A stream is a sequence of media data with a uniform type. The most common types are audio and video, but a stream can contain almost any kind of data, including text, script commands, and still images. The term stream in this documentation does not imply delivery over a network. A media file intended for local playback also contains streams. Usually, a media file contains either a single audio stream, or exactly one video stream and one audio stream. However, a media file might contain several streams of the same type. For example, a video file might contain audio streams in several different languages. At runtime, the application would select which stream to use.Compression
Compression refers to any process that reduces the size of a data stream by removing redundant information. Compression algorithms fall into two broad categories:- Lossless compression
Using a lossless algorithm, the reconstructed data is identical to the original. - Lossy compression
Using a lossy algorithm, the reconstructed data is an approximation of the original, but is not an exact match.
Media Containers
It is rare to store a raw audio or video stream as a computer file, or to send one directly over the network. For one thing, it would be impossible to decode such a stream, without knowing in advance which codec to use. Therefore, media files usually contain at least some of the following elements:- File headers that describe the number of streams, the format of each stream, and so on.
- An index that enables random access to the content.
- Metadata that describes the content (for example, the artist or title).
- Packet headers, to enable network transmission or random access.
Formats
In digital media, the term format is ambiguous. A format can refer to the type of encoding, such as H.264 video, or the container, such as MP4. This distinction is often confusing for ordinary users. The names given to media formats do not always help. For example, MP3 refers both to an encoding format (MPEG-1 Audio Layer 3) and a file format. The distinction is important, however, because reading a media file actually involves two stages:- First, the container must be parsed. In most cases, the number of streams and the format of each stream cannot be known until this step is complete.
- Next, if the streams are compressed, they must be decoded using the appropriate decoders.
- Encoding the uncompressed audio/video data.
- Putting the compressed data into a particular container format.