Video Codecs Explained: H.264 vs H.265 vs VP9 vs AV1
You open an export dialog β or drop a file into a conversion tool β and four names stare back at you: H.264, H.265, VP9, AV1. They look like model numbers on a camera lens. The tool picks one by default, you accept it, and you move on.
That works until the file will not play on your TV. Or it plays fine but it is 800MB when it should be 80MB. Or you upload to a client portal and their system rejects the format.
This guide explains what each codec actually is, what the differences mean in practice, and which one to reach for depending on what you are trying to do.
What a Codec Is β and Why It Is Not the Same as a Container
A codec is the algorithm that encodes and decodes video data. The word is a portmanteau of "coder/decoder." When you record video, the codec compresses frames down from their raw size β a single uncompressed 1080p frame is about 6MB β into something that can actually be stored and transmitted. When you play the video, the codec decompresses it on the fly so you see moving images.
A container is the file format that wraps that compressed data. MP4, MOV, MKV, WebM β these are containers. They hold the video stream, the audio stream, subtitles, and metadata, and they bundle everything into a single file.
The confusion comes from mixing the two. When someone says "send me an MP4," they mean the container. The codec inside that MP4 could be H.264, H.265, or AV1. When your TV says it cannot play a file, it often means the TV does not support the codec β not the container.
The practical implication: converting to MP4 does not guarantee compatibility. You also need the right codec inside the MP4.
H.264 (AVC) β The Universal Standard
H.264 β formally called AVC, Advanced Video Coding β was standardized in 2003. At this point it is the most widely deployed video codec on earth. Every phone, every TV, every game console, every web browser, every social platform from the last 15 years plays H.264 without issue.
Compression: H.264 is not the most efficient codec by modern standards. A file encoded in H.264 will be larger than an equivalent-quality file in H.265 or AV1. But it is not inefficient β at CRF 23, it compresses a 1080p file to roughly 1β4 Mbps, which is well under what any broadband connection or streaming platform expects.
Encoding speed: Fast. H.264 encoding is hardware-accelerated on virtually every device manufactured in the last decade β phones, laptops, desktop GPUs, even cheap ARM chips. Encoding a 10-minute video takes minutes, not hours.
Patent licensing: H.264 is patented and requires licensing fees for software that encodes or decodes it commercially. In practice this cost is absorbed by device manufacturers and browser vendors, so end users never feel it. But it matters when you are choosing a codec for a web streaming pipeline at scale.
Best for: Anything you intend to share with other people and cannot control their playback environment. Email attachments, WhatsApp, Slack, social media, client deliverables, broadcast output β if compatibility is the priority, H.264 in an MP4 container is the correct answer.
H.265 (HEVC) β Better Compression, More Friction
H.265 β also called HEVC, High Efficiency Video Coding β is the direct successor to H.264, standardized in 2013. Its headline number: roughly 40β50% better compression than H.264 at the same visual quality. A file that takes 100MB in H.264 takes 50β60MB in H.265 at the same resolution and quality level.
Why that matters: 4K footage. Archiving. Long recordings. If you are storing a library of 4K video or archiving footage you want to keep for years, H.265 cuts your storage cost nearly in half.
Encoding speed: Slower than H.264. Software-only H.265 encoding is noticeably slower β sometimes 3β5x slower than H.264 on equivalent hardware. Hardware acceleration exists on modern Apple Silicon, recent NVIDIA GPUs, and Intel Quick Sync, which closes the gap significantly. If your hardware supports it, H.265 encoding is fast. If it does not, expect to wait.
Patent licensing: This is where H.265 gets complicated. Unlike H.264, which has a single licensing body (MPEG-LA), H.265 has multiple competing patent pools with separate licensing requirements. The result: Firefox and Chrome do not enable H.265 decoding by default because the licensing situation is unresolved for browser vendors. Safari and Apple devices support it natively, which is why iPhones record in HEVC by default.
Browser support: Limited. H.265 does not play natively in Chrome or Firefox without additional hardware. This makes it unsuitable for web delivery if you cannot guarantee the playback environment.
Best for: Local storage, archiving, Apple-to-Apple workflows, and any situation where you control playback (a specific app, a specific TV, a dedicated player). If someone is watching on a Mac, iPhone, or Apple TV, H.265 is excellent. If you are sending a file to someone whose setup you do not know, H.264 is safer.
VP9 β Google's Open Alternative
VP9 is Google's answer to H.265. It was developed to be royalty-free and open, released in 2013. YouTube adopted it as its default codec for web delivery, and every Chromium-based browser plays it natively. Firefox supports it. Safari added support in 2021.
Compression: VP9 achieves compression efficiency roughly comparable to H.265 β about 30β50% better than H.264 at the same quality level. In practice, YouTube's encoding pipeline produces VP9 files that stream at lower bitrates than the H.264 equivalent while looking the same.
Encoding speed: Slow. VP9 software encoding is CPU-intensive and considerably slower than H.264. Hardware acceleration for VP9 encoding is available on some devices (recent Intel chips, some Android SoCs) but not as universal as H.264. Decoding is fast and hardware-accelerated on most modern devices, which is why YouTube can deliver it smoothly β they do the slow encoding once, and your device decodes quickly.
Royalty-free: Yes. This is VP9's key advantage over H.265. No licensing fees, no patent pool complications. Any developer can build a VP9 encoder or decoder without a royalty agreement.
Container: VP9 lives in WebM containers for web delivery, though it can also appear in MKV. You will not typically find VP9 in an MP4 file.
Best for: Web video delivery where you control the player (a modern browser) and want better compression than H.264 without H.265's licensing complications. Niche in practice β most new projects skip VP9 in favor of AV1.
AV1 β The Future Standard
AV1 is the newest codec in this group, released in 2018 by the Alliance for Open Media β a coalition that includes Google, Apple, Microsoft, Netflix, Amazon, Facebook, and Mozilla. The objective was to build a royalty-free codec that outperforms H.265.
It succeeded. AV1 achieves roughly 30% better compression than VP9 and approximately 50% better compression than H.264 at equivalent quality. Netflix's own testing showed AV1 delivering the same perceptual quality as HEVC at 40% lower bitrate.
Encoding speed: This has been the main obstacle to adoption. AV1 software encoding is extremely slow β encoding a 10-minute 1080p video can take hours on a standard CPU. Hardware acceleration is the solution, and it is arriving rapidly. NVIDIA RTX 40-series, Intel Arc, and AMD RDNA 3 GPUs all include AV1 hardware encoders. Apple Silicon added AV1 hardware decode. As these chips become the installed base, the encoding speed penalty disappears.
Royalty-free: Yes, fully. The Alliance for Open Media was explicitly formed to create a patent-free codec. This makes AV1 safe for browser vendors, streaming platforms, and developers to implement without licensing exposure.
Adoption: YouTube serves AV1 to browsers that support it. Netflix uses AV1 for mobile delivery. Chrome, Firefox, Edge, and Safari all support AV1 decoding. Hardware decoding support is now standard on 2022-and-later phones, laptops, and TVs.
Best for: Web streaming at scale, future-proof archiving, and any new pipeline being built today where encoding time is manageable. AV1 is where the industry is heading. If you are building infrastructure now, AV1 is the codec to plan around.
Codec Comparison at a Glance
The Container vs Codec Confusion
Now that you know what each codec does, here is the container picture:
MP4 is the most versatile container. It can hold H.264, H.265, and AV1 video streams. It is the container with the broadest device support. When you convert to MP4, the codec inside determines actual compatibility β a H.264 MP4 plays everywhere, an H.265 MP4 may not play in Firefox.
WebM is Google's container, designed for the web. It holds VP9 and AV1 streams. You will see WebM in browser-based video players and in content served from CDNs optimized for modern browsers. It does not play natively in all media players.
MOV is Apple's container. iPhones record in MOV wrapping an HEVC (H.265) stream. This is efficient on Apple hardware but can cause compatibility issues on Windows media players and Android devices.
MKV (Matroska) is the flexible open container that can hold almost anything β H.264, H.265, AV1, VP9, and dozens of other codecs. MKV is popular for media libraries and archiving because of its flexibility and subtitle support, but it is not universally supported on consumer devices without media player software.
The mismatch that trips people up: a MOV file from an iPhone contains HEVC inside. Windows Media Player cannot play HEVC without the HEVC codec pack installed. The fix is not to rename the file β it is to re-encode to H.264 inside an MP4 container. Understanding this distinction saves a lot of troubleshooting.
If you want to understand more about what gets discarded during this kind of conversion, the lossy vs lossless file conversion guide covers the underlying mechanics.
Which Codec Should You Actually Use
Ignore everything above and pick from this list based on your situation:
You want the file to play on any device, anywhere β use H.264 in MP4. Every device made in the last 15 years plays it. Every platform accepts it. It compresses well enough for any sharing scenario. When in doubt, this is the answer.
You are archiving video or storing 4K footage β use H.265 in MP4 or MOV. The ~45% file size reduction over H.264 adds up fast when you are storing terabytes. If you are an Apple household (iPhone, Mac, Apple TV), you will never encounter a compatibility problem. If you need to share those files with non-Apple users, convert to H.264 for delivery.
You are building a web video delivery pipeline today β use AV1 in MP4 or WebM. Browser support is there. Hardware decode is widespread. The better compression reduces bandwidth costs at scale. Encoding time is the remaining constraint, but hardware encoders make it tractable on 2022+ machines.
You are delivering video to YouTube or a browser-based player and encoding speed is critical β use VP9 as a fallback. VP9 is proven at scale, royalty-free, and supported everywhere H.264 is not enough. It is less future-proof than AV1 but more practical for pipelines that cannot yet handle AV1 encoding times.
Compressing Video with the Right Codec
Choosing the right codec matters most when you are compressing video for delivery β the codec determines how much you can reduce the file size before quality degrades visibly.
H.264 at CRF 23 is the starting point most people should use. From there, H.265 and AV1 let you push further without visible quality loss, though the encoding overhead goes up with each step. The video compression guide covers CRF settings and presets in detail if you want to go deeper on the compression side.
The codec decision and the compression decision interact. A well-compressed H.264 file beats a poorly-compressed AV1 file every time. Start with the right codec, then tune compression from there.
The Short Version
Four codecs, four use cases:
- H.264 β plays everywhere, fast to encode, safe default
- H.265 β half the file size of H.264, great for storage and Apple devices, avoid for web delivery
- VP9 β royalty-free, YouTube-proven, good browser support, slow to encode
- AV1 β best compression available, royalty-free, the industry direction, hardware acceleration arriving fast
If you are sharing a video today, use H.264 in an MP4. If you are building a system for tomorrow, plan around AV1.
Compress your video now β no software required, no account. Files are uploaded for processing and deleted automatically after about an hour.