What Is a Codec? A Plain-English Guide to Video Compression
Almost every confusing thing about video files traces back to one idea: the codec. Understand it once, and formats, file sizes and playback problems all start to make sense.
If you've ever wondered why one video is 40 MB and a seemingly identical one is 2 GB, why a clip plays fine on your laptop but not your TV, or what on earth "H.264" means — the answer to all three is the same. It's the codec.
Codec definition: what does "codec" mean?
A codec — short for coder-decoder — is software or hardware that compresses (encodes) video or audio for storage and decompresses (decodes) it again for playback. So what does "codec" stand for? It's a mash-up of coder and decoder: it squeezes video (or audio) down to a fraction of its original size when you save it — that's the coding — and reconstructs a watchable picture when you play it back — the decoding. Every video file you've ever opened was encoded by a codec, and your device had to know how to decode it to show you anything.
Why compression isn't optional
To see why codecs exist at all, it helps to know how big video really is before compression. A single frame of 1080p video is 1920 × 1080 pixels — that's just over two million pixels. Store the colour of each pixel in the usual three bytes and one frame is about 6 MB. Now play 30 of those every second:
- One second of raw 1080p video ≈ 187 MB
- One minute ≈ 11 GB
- A two-hour film ≈ 1.3 terabytes
That's obviously unworkable — you couldn't stream it, email it, or fit much of it on a phone. A good codec takes that same two-hour film and stores it in a couple of gigabytes, often with no difference you can see. Getting a 500-to-1 reduction while keeping the picture convincing is the whole magic trick.
How the trick works (without the maths)
Codecs lean on two simple observations about video and about human eyes.
1. Frames barely change
In most footage, one frame looks almost exactly like the one before it — the background is static and only a small part of the picture moves. So instead of storing every frame in full, a codec saves an occasional complete frame (a keyframe) and then, for the frames in between, records only what changed: "this block of pixels moved three pixels to the left." A talking-head video with a still background compresses enormously because so little actually changes frame to frame. This is called temporal compression, and it's why fast-moving, constantly-changing footage (confetti, water, crowds) produces bigger files than a static shot.
2. Your eyes don't notice everything
The codec also throws away detail you were never going to perceive — subtle colour variations, fine texture in dark areas, high-frequency detail the eye glosses over. This is the "lossy" part: the decoded video is not a perfect copy of the original, just one your eyes accept as equivalent. How aggressively it discards detail is the single biggest lever on quality and file size.
Lossy vs lossless
Almost all everyday video is lossy — it permanently discards some detail to hit a usable size, and that's a good trade. Lossless codecs exist (they reconstruct the original perfectly) but produce files so large they're only used inside professional editing workflows, not for anything you'd share or stream.
One practical consequence: every time you re-encode lossy video, it loses a little more, because you're compressing an already-compressed picture. In practice a single conversion on a high-quality setting is visually indistinguishable — the loss only stacks up if you re-export the same clip many times over.
Why your device plays some codecs and not others
Here's the part that causes most real-world headaches. Decoding video is demanding work, so phones, TVs and computers include dedicated hardware chips that decode specific codecs efficiently. Your iPhone has a hardware decoder for H.264 and HEVC; it may have no idea what to do with, say, a VP9 or an old RealVideo file. When a video "won't play," it's usually not broken — your device simply lacks a decoder for the codec inside it.
That's the entire reason conversion tools exist. Re-encoding a file into a codec your device does support (very often H.264 in an MP4) makes an unplayable clip play everywhere, without changing anything you'd notice about the picture.
Codec ≠ file format
A common trap: people treat "MP4" as a codec. It isn't. MP4 is a container — a box that holds the video, the audio and some metadata. The codec is what's inside the box. The same MP4 file could contain H.264 or HEVC video, which is exactly why two MP4s can behave completely differently. It's worth understanding this distinction on its own, because it explains a whole category of "but it's an MP4, why won't it open?" problems.
Bitrate: the dial behind quality
When people talk about a video's quality, they're usually really talking about its bitrate — how many bits the codec is allowed to spend per second. More bits means more detail preserved and a bigger file; fewer bits means smaller and, past a point, visible blocky artefacts. A modern codec at a sensible bitrate looks excellent; the same codec starved of bits looks like a bad video call. Choosing a codec and choosing a bitrate are the two decisions that determine what your final file looks like and how big it is.
The takeaway
A codec is just the compression method a video was saved with. It determines the file's size, its visual quality, and — crucially — which devices can play it. When a video won't open, is way too big, or needs to go somewhere with a strict size limit, what you actually want is to re-encode it with a different codec or bitrate. That's all "converting a video" really means.