Skip to content

What is a codec? (and how it differs from a container)

A video codec compresses raw frames for storage and decodes them for playback. Learn how codecs differ from containers and why Mac codec errors happen.

In short

  • A codec is an algorithm that compresses raw video or audio for storage and decodes it for display.
  • A container is a digital wrapper that synchronizes compressed video, audio, and subtitle streams together.
  • File extensions like MP4 and MKV indicate the container shell, not the underlying video compression codec.
  • QuickTime Player rejects videos when Apple AVFoundation lacks a native decoder for the file's codec or wrapper.
  • Mac users should never install legacy codec packs; modern standalone media players bundle their own decoders.
On this page
  1. How does a video codec work?
  2. What is the difference between a codec and a container?
  3. What are the most common video and audio codecs?
  4. Why does QuickTime show a missing codec error on a Mac?
  5. Do you need to install codec packs on macOS?
  6. How can you play unsupported video codecs on Apple Silicon?

A video codec is an algorithm that compresses raw image frames into a compact stream of binary data and decodes that stream back into visible pixels for playback. The term stands for coder-decoder (or compressor-decompressor), and without it, video files would be too large to download, stream, or store on consumer hardware.

A common confusion is mistaking a codec for a file extension like MP4 or MKV. While a file extension identifies the container wrapper packaging the media, the codec is the mathematical blueprint that compressed the pictures and sound inside that wrapper.

How does a video codec work?

Digital cameras capture light as uncompressed RGB sensor data. A two-hour feature film at 4K resolution (3840 × 2160) at 24 frames per second with 10-bit color requires roughly 716 MB of raw data every second. The uncompressed movie would consume more than 5 TB of storage.

A video codec solves this problem by removing redundant visual data through two methods: spatial compression and temporal compression.

Spatial compression (intra-frame coding) analyzes each frame on its own, like JPEG compression on a photo. If a scene contains a clear blue sky, the encoder does not record every pixel. It divides the image into pixel blocks and stores a mathematical description of the color gradients and textures across that region.

Temporal compression (inter-frame coding) analyzes differences across successive frames over time. Because movies display 24 or 60 pictures every second, adjacent frames are often nearly identical. If an actor speaks against a stationary wall, the wall does not move from one twenty-fourth of a second to the next. The codec records a complete baseline image called an intra-coded frame (I-frame or keyframe), and for following frames, it records only motion vectors and residual pixel changes.

During playback, the decoder reverses this process in real time. It reads the baseline keyframe, applies the motion vectors, reconstructs the missing pixels, and sends finished frames to the display buffer.

What is the difference between a codec and a container?

To understand multimedia playback, you must separate the digital wrapper from the content inside. A container format is the envelope, while codecs represent the language of the contents written on the paper.

A container file format, such as Matroska (.mkv), MPEG-4 (.mp4), QuickTime Movie (.mov), or WebM (.webm), acts as a multiplexer. It bundles separate streams of data into a unified file structure with a shared timeline. A single container file typically contains one video stream, one or more audio streams, subtitles, chapter marks, and cover artwork.

Animation

Inside a video file: one container, many tracks

Sintel.mkvMatroska container

  • VideoHEVC · 4K · 10-bit HDR→ Video decoder
  • Audio · EnglishE-AC-3 5.1→ Audio decoder
  • Audio · FrenchAAC stereo→ Audio decoder
  • Subtitles · EnglishSRT text→ Subtitle rendererConverted to MP4 timed text
  • Subtitles · JapaneseASS, styled→ Subtitle rendererNo standard place in MP4
  • Chapters12 chapters→ Player menu
  • AttachmentsFonts for the styled subtitles→ Subtitle rendererNo standard place in MP4
A container is a box; the codecs are what is in it. A player reads the box (demuxing) and sends each track to its own decoder. MKV can carry almost anything; MP4 is stricter, which is why styled subtitles and fonts don’t survive the trip.

The container synchronizes these streams so that when playback reaches a specific second, audio and subtitles align with the video. Containers follow international standards, such as the ISO Base Media File Format defined in ISO/IEC 14496-12 for MP4, or the Extensible Binary Meta Language defined in RFC 9559 for Matroska.

By contrast, codecs determine how each individual stream inside that container was compressed. For example, a single MP4 file might contain:

  • A video stream compressed with the H.264 (AVC) codec
  • An English primary audio track compressed with the AAC codec at 256 kbps
  • A Spanish secondary audio track compressed with the AC-3 (Dolby Digital) codec at 640 kbps
  • A timed text subtitle stream

Because containers and codecs operate independently, you cannot evaluate picture quality by reading a file extension alone. An MKV container and an MP4 container holding the exact same HEVC video bitstream display identical visual quality, color depth, and bitrates. To read a detailed breakdown of these two popular wrappers, see our guide comparing MKV vs MP4.

Attribute Video Codec (e.g. H.264, HEVC, AV1) Container Format (e.g. MP4, MKV, MOV)
Primary Function Compresses and decompresses raw image data Packages, interleaves, and synchronizes multiple tracks
Governing Focus Computational efficiency and visual fidelity File organization, stream multiplexing, and chapter navigation
Impact on Quality Directly determines compression artifacts and detail Zero impact on image quality; acts as a passive carrier
Hardware Dependency Often requires dedicated silicon decoder blocks Handled entirely by lightweight software demuxers
Typical Extensions Does not have a user-facing extension (FourCC inside) .mp4, .mkv, .mov, .webm, .avi, .m4v

What are the most common video and audio codecs?

Over the past three decades, video coding standards have advanced in generations. Each new generation cuts the required bitrate roughly in half compared to the standard before it, at the cost of higher computational complexity during encoding and decoding.

Major video codecs in active use

  • H.264 / AVC (Advanced Video Coding): Standardized in 2003 by the ITU-T and ISO/IEC MPEG, H.264 remains the most widely compatible video codec. Almost every smartphone, web browser, television, and computer manufactured in the last fifteen years can decode H.264 in hardware. It is the dominant codec for 1080p web video and standard Blu-ray discs.
  • HEVC / H.265 (High Efficiency Video Coding): Approved in 2013 as ITU-T H.265, HEVC delivers roughly 40% to 50% bitrate savings compared to H.264 at equivalent visual quality. It introduced native support for 10-bit color depth and High Dynamic Range (HDR) standards like HDR10 and Dolby Vision. HEVC is the standard for 4K Ultra HD Blu-ray discs and modern iPhone camera recording. For a closer look, read our full article on what HEVC is.
  • VP9: Released by Google in 2013 as a royalty-free open-source format, VP9 served as the primary workhorse for YouTube 4K streaming for over a decade. It offers compression efficiency comparable to HEVC. We explore its role in our article on what VP9 is.
  • AV1 (AOMedia Video 1): Finalized in 2018 by the Alliance for Open Media, AV1 is an open, royalty-free codec that improves compression efficiency by another 30% over HEVC and VP9. Commercial streaming platforms like Netflix and YouTube rely heavily on AV1 to deliver 4K streams at lower bandwidth. Hardware decoding for AV1 is built into Apple Silicon M3 and newer chips, as detailed in our guide to AV1 on Mac.
  • Apple ProRes: Unlike distribution codecs designed to produce compact files for streaming, Apple ProRes is an intra-frame professional production codec. Every frame is stored independently as a keyframe, creating large file sizes that require minimal processor effort to scrub, trim, and color-grade in video editing software. Learn more in our guide on what Apple ProRes is.

For a side-by-side efficiency and bitrate analysis of modern distribution formats, read our complete breakdown of H.264 vs H.265 vs AV1.

Essential audio codecs

Audio codecs compress raw multi-channel audio waveforms using psychoacoustic models that discard frequencies less audible to human ears:

  • AAC (Advanced Audio Coding): The default lossy audio codec for MP4 files, Apple ecosystem devices, and YouTube.
  • Opus: A flexible, low-latency open audio codec standardized by the IETF that performs well at lower bitrates, widely used in WebM files and modern voice platforms.
  • AC-3 (Dolby Digital) and E-AC-3 (Dolby Digital Plus): Surround sound codecs standard on DVD, Blu-ray, cable broadcasts, and commercial streaming services.
  • FLAC (Free Lossless Audio Codec): An open-source lossless audio codec that preserves original audio waveforms without discarding sound information.

Why does QuickTime show a missing codec error on a Mac?

When you attempt to open a video file on macOS and receive an alert stating “This file cannot be opened” or “The document could not be opened. QuickTime Player isn’t compatible with this file,” you are encountering a codec or container mismatch.

QuickTime Player relies on Apple’s AVFoundation framework, which enforces a strictly curated whitelist of uniform type identifiers (UTType). According to Apple Support documentation, QuickTime Player natively supports:

  • Containers: QuickTime Movie (.mov), MPEG-4 (.mp4, .m4v), and select audio wrappers like CAF and AIFF.
  • Video Codecs: Apple ProRes, H.264, HEVC (8-bit and 10-bit), Motion JPEG, and AV1 (on M3 or newer hardware inside MP4/MOV containers).
  • Audio Codecs: AAC, Apple Lossless (ALAC), FLAC, Dolby Digital (AC-3), Dolby Digital Plus (E-AC-3), and uncompressed LPCM.

If a file deviates from this list, QuickTime Player halts. If you download a video packaged in a Matroska (.mkv) container, QuickTime refuses to open it even if the video stream inside is standard H.264 that your Mac could decode. Similarly, if an MP4 container holds audio compressed in DTS Digital Surround or Opus, QuickTime opens the video with complete silence because macOS lacks an AVFoundation decoder for DTS.

To review the complete operating system whitelist, read our guide on which video formats a Mac supports. For troubleshooting common playback failures, see our article on fixing QuickTime file not compatible errors.

Do you need to install codec packs on macOS?

If you migrated to macOS from Windows, your first instinct when confronting an unplayable video might be to search for a “Mac codec pack.” On Windows, utility bundles like the K-Lite Codec Pack historically registered system-wide DirectShow filters so that any media player could read exotic formats.

You should never attempt to download or install codec packs on a modern Mac. System-wide codec architectures do not exist in modern versions of macOS.

Decades ago, macOS supported a 32-bit QuickTime Component architecture that allowed third-party plugins like Perian or Flip4Mac to inject support for AVI, DivX, and WMV into QuickTime 7. Apple deprecated this architecture in 2011 and eliminated all 32-bit code in macOS 10.15 Catalina. In modern releases like macOS 15 Sequoia and macOS 26 Tahoe, AVFoundation is locked and sandboxed. Third-party installers cannot inject codecs into Apple’s native playback engine.

Websites offering codec bundles for Mac are misleading marketing schemes or malware vectors distributing adware. Installing them will not enable QuickTime to play your files. The practical solution is to use a self-contained media player that ships its own decoders.

How can you play unsupported video codecs on Apple Silicon?

Because you cannot add codecs to QuickTime Player, watching diverse video formats on a Mac involves using an independent, open-source media player.

Modern open-source media players bypass Apple’s AVFoundation framework for demuxing and decoding. Instead, they bundle cross-platform multimedia libraries directly inside their application folder:

  1. Integrated Demuxers: Libraries like libavformat and libmatroska read the outer container wrapper, whether it is an MKV, WebM, AVI, or MPEG-TS file, parsing track layouts and chapter markers directly.
  2. Dedicated Software Decoders: Libraries like FFmpeg (libavcodec) and VideoLAN’s dav1d decode complex video and audio formats in software, handling profiles like 10-bit and 12-bit HEVC, VP9 Profile 2, and FLAC.
  3. Hardware Acceleration via VideoToolbox: When an open-source player encounters standard H.264, HEVC, or ProRes bitstreams, it routes the compressed packets directly to Apple Silicon’s hardware decoders using Apple’s VideoToolbox API.

If you must open a file specifically inside QuickTime Player or Final Cut Pro, you do not need to spend hours transcoding the video. If the file is an MKV container carrying standard H.264 or HEVC video, you can remux it into an MP4 container in seconds without re-encoding a single frame. To learn how to execute this container swap, follow our step-by-step tutorial on how to play MKV files on a Mac.

To watch video without format restrictions, try MacLC from the download page. It runs natively on Apple Silicon, plays standard and obscure video codecs out of the box, and uses VideoToolbox hardware decoding for H.264, HEVC, and ProRes.

Questions people ask

What does the word codec mean?

The word codec stands for coder-decoder or compressor-decompressor. It describes software or hardware that shrinks raw multimedia data into a compact digital bitstream and reconstructs those frames during playback.

What is the main difference between a codec and a container?

A codec compresses the actual image pixels or sound waves, while a container is the file wrapper that holds those compressed streams along with subtitles and chapters in a single file.

Why does QuickTime say a codec is missing on my Mac?

QuickTime Player relies strictly on Apple's AVFoundation system framework, which supports a limited list of formats like H.264, HEVC, and ProRes. If a file uses VP9, AV1 in MKV, or DTS audio, QuickTime halts with an error.

Do I need to download a codec pack on macOS?

No. System-wide codec packs like K-Lite or Perian do not work on modern macOS. Instead of modifying your operating system, install a video player that bundles its own open-source decoding libraries.

Before you download

MacLC is free. If it is useful to you, a gift helps it skip “Open Anyway” and funds the next release.