Codec
The algorithm that squeezes video small enough to stream — and rebuilds it on the viewer's screen. The choice behind quality, file size and device support.
A codec is the compression algorithm that shrinks video for storage and streaming and rebuilds it for playback — H.264, H.265 and AV1 are the common ones, trading efficiency against device support.
What is a codec?
A codec (coder–decoder) is the algorithm that compresses video into a manageable size for storage and streaming, then decompresses it for playback. Raw video is enormous — far too large to stream — so every video you watch online has been through a codec.
A codec is not the same as a file format. The codec encodes the actual video and audio; the container (MP4, MOV, WebM) is the wrapper that holds the encoded streams plus metadata and subtitles. An MP4 file typically carries H.264 video and AAC audio inside it — two codecs, one container.
The codec choice drives the trade-off at the heart of streaming: better compression means smaller files and lower bitrateBitrateThe amount of data used per second of video. Higher bitrate means more detail and a larger file; the core lever behind streaming quality.Open definition → for the same quality, but often at the cost of heavier encoding and narrower device support.
The common video codecs
| Codec | Also known as | Efficiency | Support | Notes |
|---|---|---|---|---|
| H.264 | AVC | Baseline | Universal | The safe default |
| H.265 | HEVC | ~2× H.264 | Broad | Licensing cost; 4K4K (2160p)Ultra HD at 3840×2160 — four times the pixels of Full HD, and the point where codec choice starts paying for itself.Open definition →-friendly |
| AV1 | — | Best; royalty-free | Growing | Heavy to encode |
| VP9 | — | ~H.265; royalty-free | Broad (web) | Common on YouTube |
H.265 and AV1 reach similar quality at roughly half the bitrate of H.264 — the reason large platforms invest in them despite higher encoding cost.
Audio codecs
Video always ships with an audio codec alongside it, and the same efficiency-vs-support logic applies:
| Codec | Efficiency | Where it's used |
|---|---|---|
| AAC | Standard | HLS and most web video — the default |
| Opus | Better at low bitrates; royalty-free | WebRTC, WebM |
| MP3 | Older, less efficient | Legacy / audio-only |
Just like video, the platform picks an audio codec the target device can decode — you don't choose it by hand.
Further reading
- Video codec — Wikipedia — a vendor-neutral overview.
- Alliance for Open Media — AV1 — the AV1 codec project.
