What is a video and audio codec

Audio and video presented digitally without any processing are very large. That is why codecs are used, they significantly reduce the size of a file, and some can even do it without affecting the quality.

How do codecs work

When playing a video or audio file, the codec decompresses it to broadcast it on the screen. The information is packaged in a special media container and stores audio and video. The codec decompresses the container and then converts the digital signal to analog through the output device.

When shooting video material, audio and video codecs "work" in the camera. They compress the information, each its own. And then these two streams are synchronized and combined in one container.

Codecs can be lossless or lossy. The first type compresses to a certain theoretical limit while remaining the highest quality possible. This limit is big and the media occupies a lot of space. Lossy codecs can compress as much as you want but at the expense of quality.

What is the difference between a codec and a container

Users are often confused while trying to understand what are codecs and containers. While we've already covered the former, we've only mentioned the latter.

Every video and audio file must be a container. A container is a repository for content. There are storages of different structures — these are container formats.

Modern containers allow you to store several video and audio tracks, graphic and text subtitles, fonts to display them, pictures, etc.

Examples of containers: MPEG, AVI, MKV, MP4, FLV, OGM, MOV. You might already know these containers, it is because file extensions are named after them.

Video codec types

And now, let’s take a look at some of the most common video codecs used today:

  • HEVC (High Efficiency Video Coding) or H.265 is a standardized digital format for compressing high definition video. It can be used to convert a large video file of the original format into one of a different format.

    This codec is the logical continuation of H.264 and features more efficient compression algorithms. With the advent of H.265 a new stage of codec development for video compression began.

  • H.264, also known as MPEG-4 and AVC (Advanced Video Coding), is a codec that is one of the leaders not only in video surveillance systems but also in digital television.

    It was the creation of this format that made it possible to achieve the development of digital cameras that today amaze with their level of quality. Capabilities of the codec give an opportunity to record a video stream in HD format with a speed of about 7-8 megabytes per second.

    All formats that existed before that time could provide recording and playback of the same quality video, but the speed of the stream was much lower. The main drawback of H.264 is the noticeably higher hardware and software requirements.

  • MPEG-2 is a standard for "general coding of moving images and related audio information" that is how the codec was described when it was released. It almost immediately became the standard for broadcast-quality television. It was much broader in scope and appeal, supporting the high resolution.

Audio codec types

Here are some of the best audio codecs that are used today:

  • AAC (Advanced Audio Coding) is an audio codec with less loss of quality when encoded than MP3 at the same size. It was originally created as a successor to MP3 with improved encoding quality.
  • Opus is a completely free, universal audio codec. It is primarily designed for the interactive transmission of voice and music over the Internet but is also applicable for storage and streaming purposes. The codec stands out due to its low latency.

Each audio and video codec has its own functionality and features. This is important to keep in mind when you want to compress a file or when you edit your videos.