Everything you need to know about video codecs and containers

8min read
Updated: Apr 07, 2021

You must have experienced at least once in your life that your computer refused to play downloaded music, video, or movie from the disk. This is a very popular problem because today there are a lot of different codecs and containers. You can get rid of this problem once and for all by reinstalling or upgrading codecs. In any case, you need to understand what a video format is.

What is a video format? A video format is a type of file format in which digital video data is stored. Video is almost always saved in a compressed form to reduce file size. Many file formats have their compressors (MPEG-1, MPEG-2, etc.) 

What is a video codec?

Codec, also known as an encoder/decoder, is an encoding tool that processes video and stores it in bytes. Codecs use algorithms to efficiently reduce the size of an audio or video file and then decompress it when needed. Video and music files are large, they are usually difficult to transfer over the internet. To solve the speed problem, people created mathematical codecs to encode or compress the signal for transmission and then decode it for viewing and editing.

What is a video container?

Video container is what we usually associate with a file format. Containers contain the various components of video: image stream, audio, and everything else. Usually, a container consists of a video codec and an audio codec, although it can also contain things like subtitles. Containers allow you to choose one codec for your video and one for your audio, which is nice – so you can use high-quality DTS audio or compress it into a format like MP3 to save more space. This just gives you a bit more control over how you record videos or copy movies. Examples of popular containers are OGG, AVI, MKV, and MPEG.

Each video application has a corresponding codec and container. Video formats tell the user which program will open the file. There are a huge number of video formats, and choosing the right one for your project can indeed be frustrating. Knowing how to convert video from/to another format would be essential for viewing and editing the video file. 

To convert video from one format to another, you can use online converters like this. There are many of them on the web, and you can also use the desktop version. Online converters are much easier to use, and there is no need to download them as desktop converters. More often than not, people convert old formats that are less and less supported by software due to their obsolescence.

How codecs differ from a container – they are often confused

To answer the question of how codecs differ from containers, it is necessary to understand what codecs are. The meaning of “codec” lies directly in its name:

  • “co” – compressor.
  • “dec” – decompressor.

A codec is a digital tool for compressing and decompressing data. Compression is needed to save space in a file. For example, an uncompressed high-definition video in raw format, at 60 frames per second, is capable of reaching a size of half a terabyte for every hour of recording.

An eight-channel audio track in 24-bit resolution will consume 16 megabytes per recording second. Such amounts of data are neither suitable for regular storage nor online transmission, so special formulas, known as codecs, are used to compress them.

If you disassemble a standard video with audio into codecs and containers, the result is three building blocks:

  1. A video codec, responsible for the degree of compression and loss of quality in the process.
  2. An audio codec, responsible for storing the audio track.
  3. Container, responsible for the storage of both codecs and additional meta-information.

Popular containers 

  1. AVI (Audio Video Interleaved) – an old (1992!) and still very popular type of container. Now begins to yield positions to more modern containers due to the lack of proper support for multiple audio tracks, subtitles, and modern codecs (like h.264). Nevertheless, it will be popular for a long time because of the broadest support by manufacturers of household appliances. Typically used in combination with codecs from the MPEG4/DivX/Xvid family.
  1. MKV (Matroska Multimedia Container) –  a modern container, developed as an open-source project and deprived of all AVI disadvantages. It is usually used in combination with modern h.264/x.264/AVC-1 codecs. 
  1. QuickTime (file extensions *.mov or *.qt) –  a rather progressive container created by Apple, supports almost all popular codecs and implementation of subtitles. Moreover, unlike MKV, it is much more suitable for editing video material recorded in such a container.
  1. FLV (Flash Video) –  Adobe Flash Video that gained enormous popularity because of YouTube. In the process of evolution, it has learned to use modern video and audio codecs, but its focus on short and highly compressed internet videos limits its scope of distribution. It doesn’t support embedded subtitles for some reason.
  1. MP4 (MPEG-4 Part 14) –  a progressive enough container, supporting video compression not only in MPEG4, as you might think from the name, but with more modern methods. But it is inferior to MKV in terms of support for subtitles and audio formats.
  1. OGG –  a container formally designed to store sound in the OGG Vorbis format but can also store video. Despite the declared capabilities, this container is exotic for video, but in the case of sound, it already has some success.
  1. WAV (Waveform Audio File Format) –  a container designed to store sound, often uncompressed. 
  1. MP3 (MPEG-1 Audio Layer III) – a container designed to store compressed sound. 

The difference between MP3 and WAV

The main difference between WAV and MP3 is that the former is uncompressed and incredibly detailed, while the latter is compressed and not very detailed. But for music in the WAV format, you’ll have to buy an external hard drive, while in the MP3 format – a flash drive. 

  • Musicians record music in WAV format in studios. The most dedicated audiophiles with excellent audio equipment use it only. 
  • The MP3 format is now very popular. It’s suitable for listening at home, on the road (with a smartphone or player), or in the car through the car stereo. In the past, a CD could hold about 50 songs in high quality or about 200 in low quality. 
  • The quality of MP3 audio is certainly not exorbitantly high, but enough. An important role is played by size. 
  • The WAV bitrate is 1140 kbps, and the MP3 bitrate is 320 kbps at the most.

On average, a three-minute song in a WAV container “weighs” about 60 MB. Compressed formats involve additional transcoding of music. The audio stream is split into separate frames, and then they are merged. Some details are lost, maybe – as with MP3 – some frequency ranges are cut off. And the result is a much smaller file! On average, a three-minute song in a high bitrate MP3 file (320 kbps) “weighs” about 10 MB.

On the other hand, you can’t say that the loss of quality is too significant for the listener. MP3 320 kbps provides sufficient quality for listening to music, watching movies, etc. Any “missing details” are either ignored by the listener or “guessed” before a full acoustic picture is constructed. Besides, the quality of playback is also affected by the quality of the equipment. 

On computers with a weak integrated sound card and Chinese speakers, MP3 64 kbps, MP3 320 kbps, or WAV will sound equally bad. But if you have a multi-channel audio system, an amplifier, a discrete sound card with a 192 kHz DAC, the WAV format will surprise you. MP3 will seem low-detailed in contrast to WAV.

Conclusion: what codec and container to choose?

If you are going to put your video on your home server to watch it later on a TV connected directly to the network or through a media player, you need to find out which formats the TV and the player recognize. Virtually all devices today support MPEG-2 encoding. 

If you are more interested in playing the finished video, you may be satisfied with the AV1 container as a good compromise between compression ratio and quality. The AV1 codec is designed to play video online in the Safari, Firefox, Edge, and Chrome browsers. The AV1 video compression rate outperforms the VP8 and H.264 codecs by 30% to 50% and the HEVC codec by up to 30-43% at high bitrates.

Fully migrating the YouTube video platform to the AV1 codec not only speeds up all video uploads by 20% to 50% but also allows streaming in 4K resolution. To minimize quality loss, when saving and converting the file, it is recommended to use AV1 codec for video and Opus for audio, wrapped in an MP4 container.

Tags

Sophia Rodreguaze

Sophia is the contributing editor at noeticforce.com. She writes about anything and everything related to technology.

More from Noeticforce
Join noeticforce

Create your free account to customize your reading & writing experience

Ⓒ 2021 noeticforce — All rights reserved