
Codec and container
Confusion between codec and container is very common. And even more if we add file extensions. This post aims to clarify these terms and show the relationship between them.
What is a codec?
The codec term comes from the concatenation of the initials of two words: encoder and decoder. Strictly speaking, a codec is a specification on how to encode a type of information and then be able to decode it. For example, a codec determines how video and audio information is compressed and decompressed. Remember that compression is a specific case of coding in which space is reduced, eliminating redundant information or low perceptual impact
What is a container?
Within the multimedia arena, a container is a specification of how different types of encrypted multimedia content are arranged within a file. These different contents are usually mainly video, audio and text.
Consider the case of a film in digital format. This movie is in an archive. When we open that file, a player runs and we can enjoy the movie. Notice that a movie has video, has audio, subtitles, information about its author, information about its duration, etc. For the convenience of the user, all these elements are grouped within a single file. The order in which they are saved in that file is the container specification.
Connection
The video information that is inside a container is usually compressed, that is, it usually follows the specification of a specific codec. The same goes for audio information. The confusion appears when there are containers and codecs with very similar or even the same names.
The most popular codecs
The most popular video codecs currently are Theora, VP8, MPEG-2, h.264, Xvid, and Divx. Regarding audio codecs: AAC, FLAC, MP3, Vorbis (ogg) and WMA are the most abundant.
The most used containers are AVI, Divx, Matroska, Flash video, MP4, MPEG, Ogg, Quicktime, MXF and WebM. Since containers are intrinsically linked to files, each one also specifies one or more possible file extensions:
AVI -> .avi
Divx -> .divx
Matroska -> .mkv, .mk3d, .mka, .mks
Flash video -> .flv, .f4v
MP4 -> .mp4
MPEG -> .mpg, .mpeg
Ogg -> .ogg
Quicktime -> .mov, .qt
MXF -> .mxf
WebM -> .webm
And to open a container and see its contents?
Containers are interpreted through a media player application, such as Windows Media Player, Quicktime (application with the same name as a container), VLC, Plex, RealPlayer or Winamp, etc.
A good option is the VLC player, since it offers compatibility with all formats under almost any platform and even allows you to play incomplete files (useful feature if you want to start playing audiovisual content that has not yet finished downloading, as long as it is be progressive). In addition, it is freely distributed.



