Ch. 1 · Video Basics

한국어日本語
6 min

What Is a Video Codec? How Encoders and Decoders Work

A codec doesn't just shrink video. It discards what the eye won't notice. Learn what H.264, HEVC and AV1 standards define, and why encoders differ.

Welcome. This course is a seminar for people who want to work with codecs for a living. It doesn't just restate the specs. Instead, each lesson picks one concept that's actually used in the field and asks: why was it designed this way?

Since this is the first lesson, let's sketch the big picture. The word codec (short for COder + DECoder) already tells you what it is: one agreement made of two matching halves.

Source video RAW / YUV Encoder Encoder Decoder Decoder Playback ≈ source bitstream The standard defines only this one arrow
The basic structure of a codec — the encoder and decoder are connected only by a contract called the bitstream
The first fact to memorize

Video codec standards (H.264, HEVC, AV1 …) do not specify the encoder. All a standard specifies is the 'syntax of the bitstream' and 'how to decode it.' In other words, the decoder has exactly one right answer, while the encoder is free.

This asymmetry shapes the structure of the whole industry. As long as you follow the spec, you can build any encoder you like, so even for the same H.264, x264 and a hardware encoder inside a smartphone chip can differ enormously in quality. A codec company's competitive edge mostly lives in its encoder. The decoder is where you can't be wrong; the encoder is where doing better wins.

Even within the single AV1 standard, the encoder matters: SVT-AV1 and libaom need different file sizes and encoding times for the same quality. See our hands-on measurement.

In the field

"How far does a codec standard's scope go?" is a classic interview question. The answer: bitstream syntax and the decoding process. The encoder's mode decisions, rate control, and preprocessing are all left to the implementation.

Why compression is possible

Compression is possible because video data is enormously wasteful. The waste falls into three kinds, and these three are the root of every technique you'll learn from here on.

Type of redundancyWhat overlapsTechnique that removes it
SpatialA pixel looks like its neighborsIntra prediction, transform (DCT)
TemporalThe previous frame is almost the same as this oneInter prediction, motion compensation
StatisticalSome values show up often, others rarelyEntropy coding (CABAC, etc.)

There's one more on top of these: psychovisual redundancy. Information the human eye can't see is simply discarded. That is what 'lossy compression' really is.

An analogy

A codec is a stenographer. Instead of writing down a lecture word for word, they use agreed-upon symbols like 'same as the previous sentence' or 'repeat that earlier word.' Filler the listener wouldn't notice isn't written down at all. The agreed-upon symbol book is the codec standard.

A map of this course

  1. 1Chapters 1–2 — The data that video is, and compression theory. If this part is shaky, everything after it becomes memorization.
  2. 2Chapter 3 — Anatomy of the hybrid codec. Every codec from AVC to AV2 shares this skeleton.
  3. 3Chapter 4 — Image codecs (the JPEG family). The ancestor of video codecs, and still in service.
  4. 4Chapters 5–8 — Video codecs by generation: AVC → HEVC → VP9/AV1 → VVC/AV2.
  5. 5Chapter 9 — Special-purpose codecs: APV, LCEVC, and others that matter precisely because they aren't mainstream.
  6. 6Chapter 10 — In practice: containers, streaming, quality assessment, and a day in the life of a codec engineer.
  7. 7Chapter 11 — Measuring video quality in practice (advanced): how to choose and run PSNR, SSIM, and VMAF properly.
  8. 8Chapter 12 — Audio codecs (advanced): sampling, choosing between AAC, Opus, and FLAC, the loudness standard (LUFS), and loudnorm.
  9. 9Chapter 13 — Hardware encoders (advanced): NVENC, Quick Sync, AMF, VideoToolbox, how they compare with software encoders, and how to check support.
  10. 10Chapter 14 — HDR workflow in practice (advanced): HDR10, HDR10+, and Dolby Vision metadata, 10-bit encoding options, SDR tone mapping, and diagnosing uploads and washed-out colors.
CodecCodec

Coder + Decoder. An agreement on how video is compressed and restored.

BitstreamBitstream

The compressed bit sequence the encoder emits and the decoder consumes. The actual thing a standard defines.

Lossy / LosslessLossy / Lossless

Whether the original can be restored exactly. Video is almost always lossy.

ConformanceConformance

Verifying that a decoder produces output bit-for-bit identical to what the standard specifies.

Psychovisual redundancyPsychovisual redundancy

Information the human eye can't perceive. Discarding it is what 'lossy compression' really is.

Check yourself

Which of the following does the H.264 standard 'specify'?

Check yourself

Which redundancy exploits the property that 'the previous frame and the current frame are almost the same'?