Technical Knowledge

What are Codec and Container Format? | Datavideo

What are Codec and Container Format?

Mar 25 2022

There are many critical elements to producing a successful high-quality video production, such as selecting different camera lenses based on the available focal lengths, exposure, frame rate setting, and color. In addition to these elements, which we have introduced before, codec, container format, and bitrate are the last few factors determining your video output quality. And in this article, we are going to explain the importance of codec, container format, and video file format.

What is Codec?

A codec, an essential element of video compression, is a device or computer program that encodes or decodes a data stream or signal. Codec is a portmanteau of coder/decoder. A coder or encoder encodes a data stream or a signal for transmission or storage, possibly in encrypted form, and the decoder function reverses the encoding for playback or editing. Hence, codec will be used in video recording, post-editing, and file export in video production. 

It is important to compress the video captured by a camera to save storage space. Let’s review the video file size at 1080p30 as an example. Given that the resolution is 1920 x 1080 so each frame contains about 2,073,600 pixels. In an RGB color space, each pixel is represented by 8 bits so the file size of each frame is (2,073,600 pixels x 8 bits) / (8 x 1024) = 2025 kilobytes. Because there are 30 frames in one second, the file size of a one-second uncompressed video is (2025x30) / 1024 = 59.33 megabytes. For a 10-second uncompressed video, the file size can be as large as 593.3 MB. As a result, long uncompressed videos can consume substantial storage on the PC or the video streaming platform and are thus impractical. 

Many manufacturers have developed their codec algorithms for playing a specific video file. For example, H.264 and Apple ProRes are standard codecs. There are two types of image compression algorithms: inter-frame compression and intra-frame compression. The so-called inter-frame compression means that when encoder only records the different parts and the information in the changing process of the two frames. Inter-frame compression does not have to record the same segments of the two frames repeatedly. The inter-frame compression can significantly reduce the size of the video; however, it consumes more processing power of the computer when playing video. H.264 codec adopts an inter-frame compression algorithm, which is also widely applied in network streaming media, such as Vimeo, YouTube, and iTunes Store.

The intra-frame compression adopts a lossy compression algorithm to compress each frame without reference to any others. Each frame is encoded as a separate image. The intra-frame compression reduces the loading of computer processing, but the file requires a significant storage space. Apple ProRes is an intra-frame compression algorithm.

Suppose the video content is a static topic, such as an interview program or a talk show. In that case, the inter-frame compression can compress the video file without the expense of the image quality. For the action theme content like sports games, intra-frame compression is the algorithm to retain better image quality and reduce the computer processing load.

What is a Container Format? 

It’s essential to distinguish codecs from container formats, though sometimes they share the same name. Briefly, container formats, or wrappers, are file formats that can contain specific types of data, including audio, video, closed captioning text, and associated metadata. A container also refers to a file extension since the term is often noted at the end of file names. Popular video containers include .mp4, .mov, or .avi which are frequently used on various major live streaming platforms such as YouTube and Facebook. MP4 is the most common type of video file format as it works across multiple platforms, operating systems, and devices.