Audio vs Video Codecs Explained: What You Need to Know
By Saqlain Noorani · Published · Updated
Understand the difference between audio and video codecs, how they compress media, and which codecs are used in popular video formats like MP4, WebM, and MKV.
What Is a Codec?
The word "codec" is a portmanteau of "coder-decoder" (or "compressor-decompressor"). A codec is an algorithm — a set of mathematical rules — that compresses raw media data into a smaller format for storage and transmission, and decompresses it back for playback.
Without codecs, digital video would be impractically large. A single minute of uncompressed 1080p video at 30 frames per second would require roughly 10 gigabytes of storage. With modern codecs like H.264, that same minute fits into about 15-50 megabytes — a compression ratio of 200:1 or more.
Audio codecs perform a similar function for sound data. Uncompressed CD-quality audio uses about 10 megabytes per minute, while AAC or MP3 compression reduces this to about 1 megabyte per minute with minimal perceptible quality loss.
How Video Codecs Work
Video compression is one of the most computationally intensive tasks in computing. Video codecs exploit several types of redundancy to achieve their remarkable compression ratios.
Spatial redundancy refers to the fact that neighboring pixels in a single frame are often similar. Video codecs use techniques like discrete cosine transforms (DCT) and block-based prediction to efficiently represent areas of similar color and texture.
Temporal redundancy is the key insight that makes video compression so effective. Consecutive video frames are usually very similar — most of the image stays the same from one frame to the next. Instead of storing every frame completely, video codecs store "keyframes" (complete images) at intervals and then store only the differences between frames for the rest.
Modern codecs like H.265 and AV1 use increasingly sophisticated prediction algorithms, variable block sizes, and advanced entropy coding to squeeze more quality into fewer bits. The tradeoff is that newer codecs require more processing power to encode and decode.
How Audio Codecs Work
Audio codecs use different techniques than video codecs because sound is a fundamentally different type of data.
The most common approach is perceptual coding, which exploits the limitations of human hearing. Our ears are less sensitive to certain frequencies and cannot hear quiet sounds that are "masked" by louder sounds at nearby frequencies. Audio codecs identify and remove these inaudible components.
Lossy audio codecs like AAC, MP3, and Opus permanently discard audio information that is deemed inaudible. The quality depends on the bitrate — higher bitrates preserve more detail. At 192 kbps or above, most listeners cannot distinguish AAC or Opus from the uncompressed original.
Lossless audio codecs like FLAC and ALAC compress audio without discarding any information. The original audio can be perfectly reconstructed from the compressed file. This results in larger files (roughly 50-60% of the uncompressed size) but guarantees zero quality loss.
Common Video Codecs
H.264 (also called AVC or Advanced Video Coding) is the most widely supported video codec in history. Released in 2003, it offers an excellent balance of compression efficiency, quality, and decoder compatibility. Virtually every device, browser, and media player supports H.264. It is the default codec for MP4 files and is used by most streaming services for standard content.
H.265 (also called HEVC or High Efficiency Video Coding) is the successor to H.264, offering roughly 50% better compression at the same quality. It is widely used for 4K content and is supported by most modern devices. However, it is encumbered by complex patent licensing, which has limited its adoption in some contexts.
VP9 is Google's open-source, royalty-free alternative to H.265. It offers similar compression efficiency and is the standard codec for WebM files. YouTube uses VP9 for most of its video streaming.
AV1 is the newest major codec, developed by the Alliance for Open Media (which includes Google, Apple, Microsoft, Netflix, and Amazon). It offers 30-50% better compression than H.265/VP9 and is royalty-free. AV1 is increasingly supported by browsers and devices, and is the future direction for web video.
Common Audio Codecs
AAC (Advanced Audio Coding) is the most common audio codec for video files. It is the default audio codec in MP4 containers and is used by Apple, YouTube, and most streaming services. AAC provides excellent quality at relatively low bitrates and is supported by virtually all devices.
MP3 (MPEG Audio Layer III) is the historic standard for compressed audio. While it has been largely superseded by AAC and Opus for new content, its universal compatibility means it remains widely used. MP3 is slightly less efficient than AAC at the same bitrate.
Opus is an open-source audio codec that excels at both speech and music compression. It offers the best compression efficiency of any lossy audio codec and supports bitrates from 6 kbps (for speech) to 510 kbps (for high-fidelity music). Opus is the default audio codec for WebM files.
FLAC (Free Lossless Audio Codec) is the most popular lossless audio codec. It is open-source, widely supported, and compresses audio to about 50-60% of the original size without any quality loss. FLAC is commonly used in MKV containers for high-quality video archives.
Codec Compatibility: What Works Where
When choosing codecs for your videos, compatibility is a major consideration.
For maximum compatibility, H.264 video with AAC audio in an MP4 container is the safest choice. This combination works on virtually every device, browser, and platform manufactured in the last 15 years.
For web-only distribution, VP9 video with Opus audio in a WebM container is an excellent choice. It offers better compression than H.264/AAC and is supported by all modern browsers. However, it may not play on older devices or in some native media players.
For archival or local playback, H.265 or AV1 video with FLAC or AAC audio in an MKV container provides the best combination of quality and flexibility. MKV supports any codec, and modern media players like VLC handle it well.
When removing audio from a video, the codec choice matters primarily for compatibility. If you use stream copying (remuxing), the video codec remains unchanged regardless of what tool you use. The container format may change, but the video data stays identical.
The Future of Codecs
The codec landscape continues to evolve rapidly. AV1 is gaining adoption for both video streaming and video communication, driven by its royalty-free licensing and strong industry support.
Next-generation codecs like VVC (Versatile Video Coding, the successor to HEVC) and AV2 are in development, promising even better compression efficiency. These will be particularly important for 8K video, volumetric video, and immersive media formats.
On the audio side, codec development has somewhat plateaued, as Opus already provides near-optimal perceptual coding. Future improvements will likely focus on immersive audio formats (3D spatial audio) rather than better compression of traditional stereo or surround sound.
For most users, the practical advice remains the same: use H.264/AAC in MP4 for compatibility, and let tools handle the codec details. As long as you use stream copying when removing audio, the specific codecs do not affect the process.