A container is defined by Wikipedia as "a meta-file format whose specification describes how data and meta-data is stored (not coded)". Basically, the container format determines how one or multiple compressed audio and/or video stream(s) can be wrapped into a single file; it defines the file structure, a mechanism for synchronized playback, support for additional information or meta-data and more.
On the other hand, a codec - shorthand for coder/decoder - is an algorithm used to compress (for storage and transmission) and/or decompress (for playback or editing) a multimedia data stream in order to reduce the amount of bytes required to store or send such a stream. After compression, the resulting data stream(s) are encapsulated (together) in a container format that supports the codec(s).
Different codecs are designed for specific hardware or software implementations, or to emphasize certain aspects of the media to be encoded. Codecs also tend to have a limited lifetime, being replaced by faster and more powerful algorithms. Currently - at the beginning of 2010 - the MPEG-4 standards (part 3, AAC for audio / part 10, H.264 for video) have become the de-facto industry standard for online multimedia.
The combination of a H.264 video stream and an AAC audio stream can be stored in different kinds of containers:
- .mp4: The official 'container' for MPEG-4 media.
- .m4a: Audio-only files can be renamed to have the .mp4 extension.
- .m4p: FairPlay protected files.
- .mp4v, .m4v: Video-only, pure MPEG-4 video streams.
- .mov, .qt: Apple-specific formats.
- .3gp, .3g2: Used by 3G mobile devices; also supports other codecs (H.263, AMR, TX3G).
Some other common container formats, at the time of writing, include:
- .ogg: A free, open standard container format that supports, among others, the Theora video and Vorbis audio codecs. The original HTML5 draft specification recommended that Ogg "should" be used for embedding video and audio in HTML documents, but this was later removed (see the Ogg controversy, continued).
- .flv, .swf: Well established container formats developed by Adobe for its Flash Player which support, among others, the Sorenson spark video codec and mp3 audio codec. These containers have been loosing a big part of their popularity since Adobe added H.264/AAC support to the Flash Player.
- .asf, .wmv: Microsoft's proprietary Advanced Systems Format, used primarily by the Windows Media Player
.
- .avi: The Audio Video Interleave container, originally introduced by Microsoft in 1992; mostly rendered obsolete by modern video compression techniques.
The Rambla Transcoding Service provides most of these container/codec combinations as default transcoding formats, but also allows customers to create their own ones (by creating custom format profiles). Both the default and custom format profiles can also be used through the Rambla Control Panel's transcoding wizard.
For more information about containers and codecs, see also:
- A gentle introduction to video encoding, by Mark Pilgrim
- Comparison of container formats, video codecs and audio codecs on Wikipedia
Update: the WebM project
On May 9, 2010 Google released WebM as an open and royalty-free video compression format for the web. The WebM project defines a container format based on a subset of the Matroska media container, which is designed to hold VP8 video and Vorbis audio streams. Even though H.264 is currently still very dominant, WebM is expected to gradually gain market share, which may result in a two-codec world for the coming years.
For more info, see the WebM vs H.264 debate from our State of Play series.



