Choose the right codec

View Markdown

Picking a codec is a tradeoff between file size, encode speed, and device support. Start with your delivery target and work backwards.

Decision tree

Where will the video play?

  • Web browsers (widest reach) — use h264. Every browser, every device. No questions.
  • Web browsers (modern only) — use av1. 30-50% smaller than h264. Chrome, Firefox, Edge, Safari 17+.
  • Apple devices (native apps) — use h265. Native hardware decode on all iPhones, iPads, Macs, Apple TVs.
  • Android apps — use h265. Hardware decode on modern Android (API 24+).
  • Open-source / royalty-free requirement — use vp9 in WebM. No licensing concerns.
  • Archival / maximum compression — use av1. Best compression ratio available today.
  • Fast turnaround / high volume — use h264. Fastest encode, lowest compute cost.

Codec comparison

CodecContainerBrowser supportRelative file sizeEncode speedDecode complexityLicensing
h264mp4UniversalBaseline (1x)FastLowLicensed (widely available)
h265mp4Safari, Edge, Chrome (partial)~0.7xMediumMediumLicensed (royalties)
vp9webmChrome, Firefox, Edge~0.7xMediumMediumRoyalty-free
av1mp4, webmChrome, Firefox, Edge, Safari 17+~0.6xSlow*HighRoyalty-free

*AV1 encoding is slow sequentially. Ittybit splits video into chunks and encodes in parallel, making it practical for production use.

Rules of thumb

  1. Default to h264 unless you have a specific reason not to. It works everywhere and encodes fast.
  2. Use AV1 when bandwidth matters — video-heavy platforms, mobile users on metered connections, CDN cost reduction.
  3. Use h265 for native apps — if your video plays in AVPlayer (iOS) or ExoPlayer (Android), h265 gives you smaller files with hardware decode.
  4. Use VP9 for open-source — when licensing matters more than Apple compatibility.
  5. Encode multiple codecs when your audience spans browsers and devices. Serve the smallest format each client supports.

Common mistakes

  • Picking AV1 for everything — encode time and cost are higher. Not worth it for short-lived or low-traffic content.
  • Using h265 for web playback — browser support is inconsistent. Always pair with an h264 fallback.
  • Ignoring your audience — if 90% of your users are on Chrome, VP9 or AV1 covers them. If 40% are on Safari < 17, you need h264.

Individual codec guides