Glossary · codec

What is Codec?

A codec is the algorithm that encodes (compresses) and decodes raw audio or video into a smaller stream. Common video codecs are H.264, H.265 (HEVC), VP9, and AV1. Common audio codecs are AAC, MP3, and Opus. The codec determines compression efficiency and which devices can play the file.

Also called:video codec · audio codec · compression

The word "codec" is a portmanteau of "coder/decoder". Every video file you have ever played went through a codec — raw uncompressed video would be ~1.5 GB per second at 1080p, which is unworkable for storage and streaming alike.

Compression efficiency varies dramatically. H.264, the codec that powers most of the modern internet, ships a 1080p movie at around 3-5 Mbps. H.265 (HEVC) and AV1 do the same job at 1.5-2.5 Mbps with no visible quality drop. The cost is encoder time: AV1 takes 10-50× longer to encode than H.264.

Container files (.mp4, .mkv, .webm) hold codec output. The same H.264 video can sit inside an .mp4 or an .mkv container — the bytes are bitwise identical, only the wrapper differs.

YouTube serves multiple codec versions of every popular video. The web player picks based on browser support; older browsers get H.264 (universally compatible), newer ones get VP9 or AV1 (better compression). When you download via VidPickr you can pick the codec via the resolution that matches it.

Common questions

Which codec should I pick for a downloaded YouTube video?
For maximum device compatibility, pick H.264 (often labeled mp4). For smallest file at the same quality, pick AV1 if your destination supports it. VP9 sits between the two — better than H.264, more universal than AV1.
What is the difference between codec and format?
Codec is the compression algorithm (H.264, AV1). Format usually refers to the container — the file wrapper (.mp4, .mkv). One container can hold multiple codec choices; one codec can sit in multiple containers.
Why does YouTube use multiple codecs?
Older devices and browsers can only play H.264. Newer ones can also play VP9 and AV1, which save 30-50% bandwidth at equal quality. Serving multiple codecs lets YouTube give each viewer the best stream their hardware supports.

Related terms

VidPickr is a free, browser-based YouTube downloader. Every term in this glossary either describes how YouTube delivers video or why your downloads behave the way they do. Try the downloader →