What Is a Video Codec? H.264, HEVC, AV1 and Why Some Files Won't Play
4 min

A video codec is a method for compressing video so it takes up far less space, and for decompressing it again when you press play. The word joins coder and decoder. Without compression, even a short clip in high definition would be enormous; with a codec such as H.264 or HEVC, a whole film fits comfortably on a phone or streams over an ordinary home connection.
Codecs are the reason one file plays everywhere while another shows sound with no picture, so a little background saves a lot of frustration.
How video compression works, in brief
Video is a rapid series of still frames, and most of each frame looks much like the one before it. A codec takes advantage of that:
- Within a frame, it groups similar areas, such as a blue sky, and describes them efficiently instead of pixel by pixel.
- Between frames, it stores occasional complete frames and, for the rest, records only what moved or changed.
- Detail the eye barely notices is simplified or discarded. This is why most video codecs are lossy: the result looks close to the original but is not identical.
The amount of data used per second is the bitrate. For the same codec, a higher bitrate generally means better quality and a bigger file. Newer codecs aim for the same quality at a lower bitrate, at the cost of more computing work.
Codec versus container: MP4, MKV and friends
This is the most common source of confusion. The file extension usually names the container, not the codec. A container is a wrapper that holds the video stream, one or more audio streams, subtitles and information such as chapters.
| Container | Typically holds | Notes |
|---|---|---|
| MP4 | H.264 or HEVC video, AAC audio | Plays on almost every phone, browser and TV |
| MKV | Nearly any codec, several audio and subtitle tracks | Very flexible; some TVs and phones need a capable player app |
| MOV | H.264, HEVC or editing codecs | Common from cameras and phones |
| WebM | VP9 or AV1 video, Opus audio | Widely used for video in web browsers |
So two MP4 files can contain different codecs, and one may play on an older TV while the other does not. Converting MKV to MP4 often needs no re-encoding at all: if the video inside is already H.264 or HEVC, tools can move the streams into a new container in a minute or two without losing quality.
The main video codecs compared
| Codec | Also called | Strengths | Watch out for |
|---|---|---|---|
| H.264 | AVC | Plays almost everywhere; light to decode | Larger files than newer codecs at the same quality |
| H.265 | HEVC | Similar quality at a lower bitrate; common for 4K and HDR | Older devices and some browsers lack support; licensing is complex |
| VP9 | — | Royalty-free; widely used for web video | Less common in cameras and discs |
| AV1 | — | Royalty-free and very efficient | Needs recent hardware for smooth playback |
In the H.264 vs H.265 question, the trade-off is simple: H.265 saves space and bandwidth, H.264 wins on compatibility. For a file you will share with family, H.264 in MP4 is still the safest choice.
Audio has codecs too
A video file's soundtrack is compressed separately. AAC is the everyday choice; Dolby Digital (AC-3) and DTS are common on film releases; Opus is frequent in web video; FLAC is lossless. A classic problem is a film that shows the picture but plays no sound on a TV, because the TV cannot decode the audio track. Switching to a different audio track or converting the audio alone usually solves it.
Why a video won't play, and what to try
- Check what is inside. Media information tools and many players show the container, video codec and audio codec.
- Update the player or device. Updates often add codec support.
- Try a player app that bundles its own codecs instead of relying on the system.
- Remux into a different container if only the container is the issue.
- Re-encode to H.264 and AAC in MP4 as a last resort; it takes longer and loses a little quality.
Choppy playback with high-resolution HEVC or AV1 files often means the device is decoding in software rather than with dedicated hardware. Playing a lower-resolution version or moving to a newer device usually helps.
Why codecs matter for streaming
Streaming services choose codecs to balance picture quality against the bandwidth viewers have, often sending different versions to different devices. More efficient codecs are part of how providers fit higher resolutions into ordinary connections, alongside faster networks of the kind described in our look at fibre, 5G and interactive TV in Germany. Our overview of streaming technology across every screen covers the delivery side. For your own files, codec choices come up whenever you convert VHS to digital or add a subtitle track; the subtitle side is explained in what is an SRT file.
Questions? Write to us.
Corrections are always welcome.