What is Codec?
Definition
A codec (coder-decoder) is software or hardware that compresses video or audio for storage (encoding) and decompresses it for playback (decoding). Common examples are H.264, H.265, VP9, and AV1 for video, and AAC, MP3, and Opus for audio.
The word codec is short for coder-decoder. Encoding compresses raw video or audio so it takes far less space, and decoding reverses the process so a player can show or play it. The codec defines the rules for that compression, which directly affect file size, visual or audio quality, and how much processing power playback needs.
A codec is not the same thing as a container. A container format like MP4, MKV, or WebM is a wrapper that holds one or more codec-encoded streams plus metadata such as subtitles and chapters. The same MP4 file could contain H.264 or H.265 video. The codec decides how the data is compressed; the container decides what is packaged together.
Newer codecs like H.265 (HEVC) and AV1 compress more efficiently than older ones like H.264, delivering similar quality at a lower bitrate, but they need more computing power to encode and decode and can carry patent or licensing differences. Choosing a codec is a trade-off between file size, quality, encoding speed, and how widely devices and browsers can play it.
Quick facts
- Codec stands for coder-decoder (also described as compressor-decompressor).
- Encoding compresses the data; decoding decompresses it for playback.
- Common video codecs include H.264, H.265 (HEVC), VP9, and AV1.
- Common audio codecs include AAC, MP3, and Opus.
- A codec is different from a container (MP4, MKV, WebM), which only wraps the streams.