What’s a codec?: Audio and video codecs explained

Vimeo Staff
What is a codec

A codec enables video playback without buffering. Every video that loads instantly has already been compressed and decompressed by a codec before anyone ever sees a frame, no matter what device it’s viewed on.

Codec is a term that comes up often in video work, usually without much explanation attached. But it’s an important part of sharing videos online: A streaming issue or a rejected platform upload can trace back to a codec mismatch, and not knowing how to fix it can severely bottleneck your publishing calendar.

This article breaks down what a codec is, how it works, and which codecs matter most for video and audio today, so every team can make the most of this important tool.

What’s a codec?

“Codec” is short for coder-decoder. It’s a set of rules for compressing raw audio or video data into smaller files for storage or transmission, then decompressing them for playback.

A codec works through two components. An encoder lets you compress a video file, reducing its size for storage or transfer. A decoder then reconstructs that compressed file into a form a media player can display or play.

Host your content on Vimeo

How do codecs work?

The exact process depends on the type of media, but a codec analyzes the input media and identifies data that's redundant or unlikely to be noticed during playback. That data gets removed or otherwise represented more efficiently, producing a smaller file than the original.

In video, what a codec is doing depends on how it handles motion. Each frame gets described in relation to the frames around it instead of being stored in full, since much of the image often stays the same from one frame to the next.

Similar to video codecs, audio codecs are what compresses sound, whether it’s a solo musical track or an audio track accompanying a product demo. The same compression principles apply to both.

Bitrate and video quality are directly linked. Bitrate is the amount of data used per second of video or audio, and a higher bitrate generally allows more of that detail to survive compression. More compression means a smaller file but potentially lower quality video, while less compression preserves more detail but needs more storage and bandwidth to handle that extra data.

Lossy vs. lossless codecs

Among the types of codecs, the most basic distinction is whether their compression is lossy or lossless. Lossy compression permanently discards data to shrink the file size, while lossless compression keeps all the file’s original data. How noticeable that loss is depends on the content and the compression level.

Lossy compression is standard for streaming platforms and web delivery, since viewers often can't detect the difference at a typical bitrate. But when streaming bandwidth is limited, these codecs encode files at a lower bitrate to compensate, so the experience stays as smooth as possible for most viewers. Aggressive compression can make a video look blocky or blurry, or audio sound muffled or distorted.

AAC and H.264 codecs both use lossy encoding, and their widespread device support and standardization are another major part of why lossy compression has become the default for everyday streaming and playback.

On the other hand, lossless compression reconstructs a video exactly during playback. That means that large files stay large, so lossless compression is a better fit for professional film production and archiving. In everyday delivery, the extra storage and bandwidth costs outweigh the benefit of maintaining ultra high quality files.

FLAC is a common example of lossless encoding, commonly used when audio files have to survive multiple rounds of editing without degradation.

What is an example of a codec?

A "codec" is short for "coder-decoder" and is a set of rules that define how images or sounds are converted to digital. Codecs like AV1 and Opus are high-quality, open codecs that are royalty-free and allow the best experience for our users.

4 common video codecs

The right video codec depends on why you’re using it, whether that's streaming, editing, broadcasting, or archiving. Streaming codecs in particular tend to favor compression efficiency and broad compatibility over raw quality, since files need to move across unpredictable networks.

Some video codecs are open source and royalty-free, while others are proprietary and require licensing, affecting cost and compatibility as you scale. Here are four of the most common ones you’ll find.

1: H.264/AVC

H.264, also called AVC, runs on more devices, browsers, and platforms than any other video codec available today. Even at low bitrates, it maintains consistent video quality, which is why it's often picked when broad reach matters more than squeezing out every last bit of compression efficiency.

2: H.265/HEVC

H.265, or HEVC, roughly doubles the compression efficiency of H.264, delivering roughly the same quality at about half the bitrate. This matters most for 4K and HDR content, since those files carry far more data than standard resolution, and HEVC's efficiency keeps the bitrate manageable without a visible drop in quality. The tradeoff is processing power: HEVC needs more of it to encode and decode, and some devices and browsers don't offer it natively.

3: VP9

VP9 is a codec produced by Google and used across Google products, including Chrome browsers and YouTube. Its compression creates smaller, higher quality files than H.264, and it carries no licensing fees, so it’s a workable pick for anyone building outside the MPEG-licensed codec lineup.

4: AV1

Developed by the Alliance for Open Media, AV1 is an open, royalty-free codec that outperforms both H.264 and VP9 in compression efficiency. Because of this quality pairing, the streaming industry is moving toward establishing AV1 as the codec standard for high-quality web video without the same licensing costs of AVC/HEVC codecs.

Try Vimeo's video editor

3 common audio codecs

The same compression principles that go into video files also apply to audio, just tuned for sound instead of images. Here are the three audio codecs you’re likely to see online.

1: MP3

MP3s play on just about anything with a speaker. This codec is decades old and still the most recognized name in audio compression. Newer codecs like AAC and Opus compress more efficiently, but MP3 remains the standard when a wide reach matters more than file size.

2: AAC

Advanced audio coding, or AAC, has become the standard choice for streaming and video audio. It matches MP3’s bitrate, but outperforms the codec’s sound quality. Browsers, devices, and platforms across the board can generally support it without any extra software.

3: Opus

Opus handles both music and speech well, adjusting smoothly to shifting bitrates and keeping latency low. That adaptability is why live streams and real-time video lean on it when network conditions aren't steady. Plus, it’s royalty-free, so it’s more accessible than some other audio codecs.

Codec vs. container: What's the difference?

A codec and a container are often mixed up, but they handle different jobs.

The container, sometimes called the file format, is the wrapper that holds the compressed video and audio streams together. MP4, MOV, and MKV are all examples of containers.

The video codec is the algorithm doing the actual compressing and decompressing inside that wrapper. An MP4 file might hold video encoded with H.264 or AV1, for example. That's why a file can open fine but fail to play correctly on a streaming platform or home speaker: The container is supported, but the codec inside it isn't.

FAQ

What’s the best video codec for MP4?

MP4 supports several video codecs, but H.264 remains the safest choice for broad compatibility across devices and browsers. AV1 is a close second and offers better compression efficiency if you’re prioritizing file size and quality over guaranteed playback on older hardware, like an internal training video when you know everyone in the office uses a newer MacBook.

What are video conferencing codecs?

Video conferencing tools rely on codecs built for low latency rather than maximum compression, since a call needs to stay in sync as it’s happening. H.264 is common for the video portion, while Opus often handles audio because it adapts well to spoken words over shifting network conditions.

What’s the best video codec for streaming?

H.264 remains the most broadly compatible option for streaming, playing reliably across nearly every device and platform. AV1 and HEVC both compress more efficiently and suit higher-quality streams, though device support for both is still catching up to H.264’s capacity.

How Vimeo handles video encoding

On Vimeo, video uploads automatically get encoded, so creators never have to choose a codec themselves. Vimeo transcodes each upload into multiple formats: H.264 for broad device compatibility, HEVC for HDR content, and AV1 for a sharper experience on the devices that support it. That way, every viewer can get an optimal experience for their bandwidth.

Vimeo uses open, royalty-free codecs like AV1 and Opus whenever possible, since they deliver strong quality without adding licensing costs or locking out certain devices. That keeps playback consistent across the video library, whether a viewer is on a phone, a laptop, or a smart TV, which means one fewer video optimization decision you have to make yourself.

More from the Vimeo blog

Video format and quality options from Vimeo, including 4K, 8K, and HDR

The H.264/AVC codec: Everything you need to know

Vimeo transcoding converters

9 best Mac and PC video transcoding converters: Free and paid

We've got a new pair of tech-y upgrades designed to drive even more views to your gorgeously crafted videos.

Your video thumbnails just got better

Today, we’re excited to announce our latest player tool designed to help your viewers easily navigate your videos and find those important moments faster.

Easy navigation for your videos with Chapters

We’re excited to announce a few analytics features we’ve rolled out that bring a deeper insight into how people are watching your videos.

3 updates to our video analytics features

Burning questions answered by the man behind the Burning Man Project’s 24/7 live stream.

Streaming live from the Playa

Going on a trip? Document your travels — and all those precious memories — with our summer vacation video tips, designed with your viewers in mind.

5 tips for making the best summer vacation video

We’re excited to announce that we’re taking the next step in our commitment to high quality video by launching support for the AV1 codec.

AV1: Setting a new standard for video codecs