A media container format (or sometimes referred to as wrapper format) is a format that can contain various types of data such as audio and video data. The data is compressed using a codec.
A codec (a compound of coder and decoder) is an algorithm used to compress and/or decompress a multimedia data stream in order to reduce the amount of bytes needed to store or send.
Some container formats are limited to audio, like WAV files for Windows, AIFF for Mac and XMF; some are limited to still images such as FITS and TIFF. There are also containers that are flexible; it can hold several types of audio, video and other media such as ASF files for Windows, MP4 and Matroska. The most common multimedia containers are:
3GP – used by mobile phones
ASF – standard WMA and WMV container
AVI – standard Windows container
Matroska – open standard container
MPEG – standard container for MPEG-1 and MPEG-2
MP4 – standard container for MPEG-4
Ogg – free and open standard container for codecs Vorbis (audio) and Theora (video)
The distinctions between different container formats come up from five (5) main issues:
Popularity. Widely supported container.
Overhead. Example: A two-hour film may be 3MB larger when in AVI than when in Matroska (MKV). The overhead is the difference between AVI and MKV which is 3MB.
Support new codec functionality and features. Some older container formats does not support codec feature such as VBR audio and B-frames.
Subtitles, chapters, meta-tags, and user-data support.
Streaming media support.
Here is a comparison of the different popular container formats today (from Wikipedia).
Support for B-frames; variable bit rate audio; variable frame rate; 3GPP Timed Text subtitle; support MPEG-4 Part 2, H.263, and H.264/MPEG-4 AVC video formats; support AAC, AMR-NB, AMR-WB+, AMR-WB, HE-AAC and HE-AAC version 2 audio formats
Advanced Systems Formats
Support for B-frames, chapters, subtitles, and metadata/tags; variable bit rate audio; variable frame rate; support almost any video format through DMO or VFW; support almost any audio through ACM or DMO
Support for B-frames; variable bit rate audio; variable frame rate; chapters and subtitles are via a third party modification; support almost any video format through VFW; support almost any audio formats through ACM
Matroska (MKV, MKA)
Support for B-frames, chapters, subtitles, and metadata/tags; variable bit rate audio; variable frame rate; support almost any video and audio formats
MPEG Video File (MPG, MPEG)
Support for B-frames; variable bit rate audio; variable frame rate; support MPEG-1, MPEG-2 video formats; support MPEG-1 Layers I, II, III (mp3) audio formats, other formats only in private streams
Support for B-frames, metadata/tags, and menus; variable bit rate audio; variable frame rate; chapters a) in specially formatted text track, and b) in userdata atom can not work together with the sceneDescription, or segmentDescriptor; ttxt and BIFS subtitles, VobSubs subtitle with private objectTypeIndication is not working with the sceneDescription; support Dirac, H.263, MPEG-4 ASP, H.264/MPEG-4 AVC, VC-1, and other video formats; support AC-3, ALS, Apple Lossless, SLS, MPEG-2/4 (HE)-AAC, MPEG-1/2 Layers I, II, III (MP3), Vorbis(with private objectTypeIndication), and other audio format
Support for B-frames, chapters, and Ogg Writ and Ogg Kate subtitles; variable bit rate audio; variable frame rate; support almost any video formats through VFW and supports almost any audio format through ACM