There’s wide extended confusion when customers/end
users ask for certain codecs. Most of them really
refer to containers’ formats instead of audio and
video codecs.
A container or wrapper format is a metafile
format whose specification describes how different
elements of data and metadata coexist in a computer
file. Containers "contain" the various components
of a video: the stream of images, the sound, and
anything else. For example, you could have multiple
soundtracks and subtitles included in a video file,
if the container format allows it. They’re easy to
distinguish because they determine the extension of
your video file. Popular container formats include
MP4 (.mp4), AVI (.avi), QuickTime (.mov) and
Matroska (.mkv).
According to the previous explanation, we have the following:
-
Codecs are ways of "coding" and "decoding"
streams. Their job is typically to compress data
(and decompress it when playing it back) so that
you can store and transmit files with a smaller
filesize.
-
In comparison, a container is what holds the
grouping of compressed video as defined by the
codec. The container takes care of packaging,
transport, and presentation.
The different container formats all have different
strengths and weaknesses, with certain formats
preferred by certain content providers. Not all
containers support all compression standards or
allow for secondary features like subtitles and
chapters. The container itself doesn’t affect the
quality of the video directly, but it can limit the
compression codecs available for use.
If you’re choosing a container format to use for
an encoded video, you’ll want to pick one that has
the right mix of supported compression codecs and
features.