Technology

What Is Codec?

A codec (coder-decoder) is an algorithm that compresses and decompresses audio or video data, determining the quality, file size, and compatibility of media files.

Codec explained

A codec (portmanteau of coder-decoder) is a software algorithm that encodes (compresses) raw media data into a compact format and decodes (decompresses) it for playback. Codecs are distinct from container formats: the codec handles the actual compression math, while the container (MP4, MKV, WebM) packages the compressed streams together. Popular video codecs include H.264 (the most widely compatible), H.265/HEVC (50% better compression), VP9 (Google's open-source alternative), and AV1 (the newest, most efficient, and royalty-free option). Popular audio codecs include AAC, MP3, Opus, and FLAC. Choosing the right codec involves balancing compression efficiency, quality, encoding speed, hardware support, and licensing — there is no single best codec for every situation.

Key points

Codecs handle compression/decompression math; containers package the compressed streams
H.264 is the most widely compatible video codec, supported by virtually all devices
H.265/HEVC offers ~50% better compression than H.264 but has patent licensing costs
AV1 is the newest video codec: best compression, royalty-free, but slow to encode
Opus is the best general-purpose audio codec for both speech and music
Hardware decoding support determines whether a device can play a codec efficiently

Real-world examples

Choosing H.264 codec for a video destined for maximum device compatibility
Re-encoding a video from H.264 to H.265 to halve file size for storage
Using Opus audio codec in a WebM container for high-quality web audio at low bitrates

Convert video and audio files

Free online file converter. No signup required.

Convert now