Codecs vs Containers
A video codec compresses and decompresses video data. The container (MP4, MKV, WebM) is the file that wraps the compressed streams together. The codec determines the actual quality, file size, and processing requirements — it is the most important technical choice you make when encoding video.
In 2026, three codecs dominate: H.264 (the established universal standard), H.265/HEVC (its more efficient successor), and AV1 (the royalty-free challenger from the Alliance for Open Media).
H.264 (AVC): The Universal Default
H.264 was finalised in 2003 and remains the most widely deployed video codec on earth. It works on every device, in every browser, and with every piece of video software. When in doubt, H.264 is the safe choice.
Strengths
- Universal hardware decoding support — phones, tablets, smart TVs, game consoles, set-top boxes
- Fast encoding, even on modest hardware
- Extensive tooling and documentation
- Predictable behaviour across all platforms
Weaknesses
- Lower compression efficiency than H.265 or AV1 — larger files at the same quality
- Limited to 8-bit colour in most implementations (10-bit profiles exist but are rarely used)
- Patent-licensed (though widely licensed and free for end users)
H.265 (HEVC): Better Compression, Complicated Licensing
H.265 was standardised in 2013 and delivers roughly 50 % bitrate savings over H.264 at equivalent visual quality. This makes it particularly attractive for 4K content where H.264 file sizes become impractical.
Strengths
- ~50 % smaller files than H.264 at the same quality
- Native 10-bit and HDR support
- Good hardware decoding support on devices from 2016 onwards
- Used by Apple (iPhone recordings), Netflix (4K streams), and many broadcasters
Weaknesses
- Complex patent licensing involving multiple patent pools — this has slowed adoption
- No native support in Firefox or Chromium on many platforms without OS-level codecs
- Encoding is 2–5× slower than H.264
- Higher hardware requirements for real-time encoding
AV1: Royalty-Free and Future-Facing
AV1 was released by the Alliance for Open Media (AOMedia) in 2018. It offers compression efficiency comparable to H.265 — sometimes better — without any royalty obligations. Major backers include Google, Mozilla, Microsoft, Netflix, Amazon, and Apple.
Strengths
- Royalty-free — no licensing costs for anyone
- Comparable or better compression than H.265
- Growing hardware decoding support (most devices shipping since 2022 include AV1 decode)
- Native browser support in Chrome, Firefox, Edge, and Safari
- Used by YouTube, Netflix, and other major platforms
Weaknesses
- Encoding is significantly slower than both H.264 and H.265 (though SVT-AV1 has improved this)
- Hardware encoding support is still limited to newer GPUs (Intel Arc, NVIDIA RTX 40-series, AMD RX 7000-series)
- Older devices (pre-2020) generally cannot decode AV1 in hardware
Side-by-Side Comparison
| Feature | H.264 | H.265 (HEVC) | AV1 |
|---|---|---|---|
| Year standardised | 2003 | 2013 | 2018 |
| Compression vs H.264 | Baseline | ~50 % smaller | ~50 % smaller |
| Licensing | Patent-licensed | Complex patent pools | Royalty-free |
| Browser support | Universal | Partial | Widespread |
| Hardware decode | Universal | 2016+ devices | 2020+ devices |
| Hardware encode | Widespread | Moderate | Limited (2022+) |
| Encoding speed | Fast | Moderate | Slow (improving) |
| HDR support | Limited | Yes | Yes |
| Max resolution | 8K (in theory) | 8K | 8K |
When to Use Each Codec
Use H.264 when:
- You need guaranteed playback on every device including very old hardware
- You need fast encoding for live streaming or real-time processing
- File size is less important than compatibility
Use H.265 when:
- You are targeting Apple devices or known-compatible platforms
- You are encoding 4K or HDR content and need efficient compression
- You are delivering to smart TVs and devices that support HEVC but not AV1
Use AV1 when:
- You want the best compression without licensing concerns
- You are publishing to the web and can accept the encoding time
- Your audience uses modern browsers and devices (2020+)
- You are building a platform and want to avoid future patent costs
Frequently Asked Questions
Is AV1 replacing H.264?
Gradually, yes — particularly for web delivery. YouTube now serves AV1 to supported devices by default. But H.264 will remain necessary for years due to the vast installed base of older hardware.
Why is H.265 support so inconsistent?
H.265's fragmented patent licensing discouraged browser vendors (especially Google and Mozilla) from including it natively. This is exactly the problem AV1 was created to solve.
Which codec should I use for 4K video?
H.265 or AV1. H.264 at 4K resolution produces very large files (50–100 Mbps for decent quality) and offers no practical advantage over the newer codecs.