Codec
Software that encodes and decodes digital media — compressing video or audio for storage and decompressing it for playback.
Last updated
What Is a Codec?
Codec is a portmanteau of coder/decoder. It is software (or hardware) that encodes a media stream into a compressed format for storage or transmission, and decodes it back to raw audio or video for playback.
Container vs Codec
This distinction causes most "video won't play" confusion:
Container (MP4, MKV, AVI, MOV) — the outer wrapper file. Stores multiple streams (video, audio, subtitles) and synchronises them.
Codec (H.264, H.265, VP9, AAC, MP3) — the compression algorithm used on the data inside the container.
An MP4 file can contain H.264 video + AAC audio, or H.265 video + MP3 audio, or many other combinations. When a video "won't play," the problem is usually that the device has the container library but not the codec for the stream inside.
Common Video Codecs
| Codec | Container | Quality/Size | Support |
|---|---|---|---|
| H.264 (AVC) | MP4, MKV | Good — baseline standard | Universal |
| H.265 (HEVC) | MP4, MKV | ~50% smaller than H.264 | Most modern devices |
| VP9 | WebM | Similar to H.265 | Chrome, Firefox |
| AV1 | WebM, MP4 | Best compression | Growing support |
| MPEG-2 | MPEG, VOB | Older — large files | DVD players |
Common Audio Codecs
| Codec | Container | Use Case |
|---|---|---|
| AAC | MP4, M4A | Streaming, Apple devices |
| MP3 | MP3 | Universal music |
| FLAC | FLAC, MKV | Lossless audio |
| Opus | WebM, OGG | WebRTC, Discord voice |
| AC3 (Dolby) | MP4, MKV | Surround sound |
Why Codec Errors Happen
"Cannot play this video" or "no audio" errors occur when the playback device lacks the decoder for the codec used in the file. Solutions:
- Install VLC (plays virtually any codec on any OS — free)
- Install K-Lite Codec Pack (Windows)
- Re-encode the file to a universally supported codec (H.264 + AAC)