# Compare video codecs

Side-by-side quality, size, and speed comparison of h264, h265, VP9, and AV1

Four codecs cover nearly every video delivery scenario. Here is how they compare on the metrics that matter.

## Benchmark comparison

All numbers are relative to h264 at the same visual quality (VMAF ~95).

| Codec  | Container | Browser support                   | Relative file size | Encode speed    | Decode complexity | Licensing            |
| ------ | --------- | --------------------------------- | ------------------ | --------------- | ----------------- | -------------------- |
| `h264` | mp4       | Universal                         | 1.0x (baseline)    | 1.0x (baseline) | Low               | Licensed             |
| `h265` | mp4       | Safari, Edge, Chrome (partial)    | ~0.7x              | ~0.5x           | Medium            | Licensed (royalties) |
| `vp9`  | webm      | Chrome, Firefox, Edge             | ~0.7x              | ~0.4x           | Medium            | Royalty-free         |
| `av1`  | mp4, webm | Chrome, Firefox, Edge, Safari 17+ | ~0.6x              | ~0.15x\*        | High              | Royalty-free         |

\*Sequential encode speed. Ittybit parallelizes AV1 encoding across chunks, bringing wall-clock time much closer to h264.

## Encode the same clip with each codec

Take a 1080p 60-second source and encode it four ways:

```bash
# h264 -- universal baseline
ittybit video \
  -i source.mov \
  -o output-h264.mp4 \
  --codec h264 \
  --quality high

# h265 -- smaller, Apple/Android native
ittybit video \
  -i source.mov \
  -o output-h265.mp4 \
  --codec h265 \
  --quality high

# vp9 -- royalty-free, Chrome/Firefox
ittybit video \
  -i source.mov \
  -o output-vp9.webm \
  --codec vp9 \
  --quality high

# av1 -- smallest files, modern browsers
ittybit video \
  -i source.mov \
  -o output-av1.mp4 \
  --codec av1 \
  --quality high
```

## Typical results (1080p, 60s, high quality)

| Codec  | Output file     | Approx. size | Encode time (local) |
| ------ | --------------- | ------------ | ------------------- |
| `h264` | output-h264.mp4 | ~25 MB       | ~8s                 |
| `h265` | output-h265.mp4 | ~18 MB       | ~16s                |
| `vp9`  | output-vp9.webm | ~17 MB       | ~20s                |
| `av1`  | output-av1.mp4  | ~15 MB       | ~55s                |

Results vary by content. High-motion footage benefits more from newer codecs. Talking-head video shows smaller differences.

## Browser support matrix

| Browser        | h264 | h265    | VP9 | AV1 |
| -------------- | ---- | ------- | --- | --- |
| Chrome 70+     | Yes  | Partial | Yes | Yes |
| Firefox 67+    | Yes  | No      | Yes | Yes |
| Safari 17+     | Yes  | Yes     | No  | Yes |
| Safari < 17    | Yes  | Yes     | No  | No  |
| Edge 79+       | Yes  | Yes     | Yes | Yes |
| iOS Safari     | Yes  | Yes     | No  | 17+ |
| Android Chrome | Yes  | Yes     | Yes | Yes |

## When to pick what

| Scenario                      | Best codec | Why                                       |
| ----------------------------- | ---------- | ----------------------------------------- |
| Maximum compatibility         | h264       | Plays everywhere, no exceptions           |
| Bandwidth-sensitive web       | AV1        | Smallest files, modern browser coverage   |
| Native iOS/Android app        | h265       | Hardware decode, no browser involved      |
| Open-source project           | VP9        | Royalty-free, good browser support        |
| Archive / cold storage        | AV1        | Best compression, decode speed irrelevant |
| High-volume / fast turnaround | h264       | Cheapest to encode at scale               |