Difference between codec and container
- Sergei Rakov
- 2 февр. 2023 г.
- 1 мин. чтения
Обновлено: 18 февр. 2023 г.

There are two essential things that people usually often confuse. It is a codec and container. In video technology, a codec is software or hardware that is used to compress and decompress digital video and audio data. Its primary function is to reduce the amount of data required to represent a video or audio file while maintaining a reasonable quality level. Codecs can be lossy, meaning that some data is lost during the compression process, or lossless, meaning that no data is lost.
On the other hand, a container is a file format that stores and organizes video, audio data, and other additional information such as subtitles, metadata, and more. Containers do not compress or decompress data but package it into a single file.
In simple terms, a codec is like a set of instructions that tells the computer how to compress and decompress the video and audio data, while a container is like a box that holds the video and audio data, the codec instructions, and any other additional information.
For example, a video file can be encoded using H.264 codec and saved in an MP4 container. The MP4 container holds the compressed H.264 video, audio data, and other information like subtitles. At the same time, the H.264 codec is responsible for compressing and decompressing the video and audio data.
Codec: H.264/H.265/aac
Transport, a.k.a. transport container, a.k.a. container: MPEG-TS, RTMP, RTP.