Video Trim
Blog

Video Codecs Explained: H.264, H.265, VP9 and AV1

• Video Trim Team

If you have ever wondered why one video plays everywhere and another refuses to open, the answer is usually the codec. Here is what the four common ones actually do.

Codec versus container

First, a distinction that causes endless confusion. A container is the file format: MP4, MOV, WebM, MKV. It is a box that holds video, audio, subtitles and metadata together. A codec is the compression method used for the video inside that box.

So “MP4” tells you almost nothing about how the video is compressed. An MP4 usually contains H.264, but it can contain H.265 or AV1. Two files with the same extension can behave completely differently. This is why a video sometimes plays with sound but no picture: your device understands the container and the audio codec, but not the video codec.

H.264 (AVC)

Standardised in 2003 and still the default almost everywhere.

Its advantage is not technical, it is universal support. Every phone, browser, smart TV, editing program and social platform released in the last fifteen years decodes H.264. Hardware decoders are built into essentially every chip, which means playback is fast and battery-efficient.

Its disadvantage is efficiency. Newer codecs achieve the same visual quality in substantially smaller files.

Use it when compatibility matters more than file size, which is most of the time. If you are unsure what to pick, pick this.

H.265 (HEVC)

The direct successor to H.264, offering roughly 25 to 50 percent smaller files at comparable quality.

The problem is licensing. H.265 carries patent royalties from multiple pools, which made adoption messy. Apple supports it thoroughly; iPhones record in it by default. Browser support is inconsistent, and some editing software requires a paid extension to handle it.

This is why iPhone footage sometimes will not open on a Windows machine or in a web tool. The file is fine; the decoder is missing.

Use it when you are staying inside the Apple ecosystem, or storing footage where size matters and you control playback.

VP9

Google’s royalty-free answer to H.265, developed for YouTube. Efficiency is broadly comparable to H.265.

Because it is free to implement, browser support is excellent, and it is well handled on Android. It is weaker outside the web: hardware decoding is less universal, and support in traditional editing software is patchier.

Use it when the destination is the web, particularly in a WebM container.

AV1

The current generation, developed by an industry consortium including Google, Netflix, Amazon, Mozilla and Apple. Royalty-free, and roughly 30 percent more efficient than VP9 or H.265.

The catch is encoding cost. AV1 is computationally expensive to encode, often dramatically slower than H.264. Hardware encoding support only arrived in recent GPU generations. Decoding support is now widespread in browsers and newer devices, but older hardware falls back to slow software decoding.

Use it when you are distributing at scale and the encoding cost is amortised across many viewers, which is why streaming services adopted it first.

Choosing in practice

Ask where the file is going.

Sending it to someone, or uploading anywhere: H.264 in an MP4. It will work. Platforms re-encode uploads to their own formats anyway, so there is little value in delivering an exotic codec.

Archiving your own footage: H.265 or AV1, if your playback devices handle them, for the storage saving.

Embedding on your own website: VP9 or AV1 in WebM, with an H.264 MP4 as a fallback.

Editing: whatever your software handles fastest, which is usually H.264. Convert exotic source footage before you start rather than fighting it throughout.

Why file sizes vary so much

Codec choice is only one factor. Bitrate matters more directly: it is how many bits per second the encoder is allowed to spend, and it is the main lever on both size and quality. Resolution, frame rate and how much movement the footage contains all feed into it too. A static talking head compresses far better than handheld footage of falling leaves, at identical settings.

This is also why trimming a video does not always shrink it proportionally. Remove half the duration and you usually get roughly half the size, but if the half you kept is the busy half, it will be larger than you expect.