{
  "schemaVersion": 1,
  "contentVersion": "ca42e61ede0a24f789d7287a0001244ad22f4abf",
  "id": "docs/start-here/encoding-basics",
  "collection": "docs",
  "title": "Encoding basics",
  "description": "What codecs, encoders, decoders and containers are, and how they fit together in a media file.",
  "canonicalUrl": "https://encode.wiki/start-here/encoding-basics/",
  "apiUrl": "https://encode.wiki/api/v1/documents/docs/start-here/encoding-basics.json",
  "markdownUrl": "https://encode.wiki/api/v1/markdown/docs/start-here/encoding-basics.md",
  "status": "current",
  "tags": [
    "migrated"
  ],
  "license": "CC BY-SA 4.0",
  "dates": {
    "lastVerified": "2026-10-08T00:00:00.000Z"
  },
  "authors": [],
  "sources": [
    {
      "title": "FFmpeg documentation — overview of demuxing, decoding, encoding and muxing",
      "url": "https://ffmpeg.org/ffmpeg.html#Detailed-description",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    }
  ],
  "provenance": {
    "originUrl": "https://github.com/av1-community-contributors/codec-wiki/blob/37c3317fd058b23c71a87679bed5619a98f77752/docs/introduction/prologue.mdx",
    "originCommit": "37c3317fd058b23c71a87679bed5619a98f77752",
    "migratedAt": "2026-08-21T00:00:00.000Z",
    "modified": true,
    "originPath": "docs/introduction/prologue.mdx"
  },
  "headings": [
    {
      "depth": 2,
      "text": "What is a codec",
      "anchor": "what-is-a-codec"
    },
    {
      "depth": 2,
      "text": "Containers",
      "anchor": "containers"
    }
  ],
  "sections": [
    {
      "id": "_preamble",
      "title": "Page introduction",
      "depth": 0,
      "canonicalUrl": "https://encode.wiki/start-here/encoding-basics/",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/start-here/encoding-basics/_preamble.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/start-here/encoding-basics/_preamble.md",
      "checksum": "6a49204e8f50ac34512f1c55cbdc08db405d3a86af3d6df0b201b7a308fc530b",
      "bytes": 373
    },
    {
      "id": "what-is-a-codec",
      "title": "What is a codec",
      "depth": 2,
      "anchor": "what-is-a-codec",
      "canonicalUrl": "https://encode.wiki/start-here/encoding-basics/#what-is-a-codec",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/start-here/encoding-basics/what-is-a-codec.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/start-here/encoding-basics/what-is-a-codec.md",
      "checksum": "740debd189d47058596a0930bfca2fab1f32e1b4627e2a1e4a7c8983489c7a0e",
      "bytes": 1883
    },
    {
      "id": "containers",
      "title": "Containers",
      "depth": 2,
      "anchor": "containers",
      "canonicalUrl": "https://encode.wiki/start-here/encoding-basics/#containers",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/start-here/encoding-basics/containers.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/start-here/encoding-basics/containers.md",
      "checksum": "4ee7469b6236fa5957cbba16ad53e0d392a26e3ce15597cdee74b612d07aa789",
      "bytes": 571
    }
  ],
  "outboundReferences": [
    "/codecs/audio/aac/",
    "/codecs/audio/flac/",
    "/codecs/audio/mp3/",
    "/codecs/audio/opus/",
    "/codecs/data/zip/",
    "/codecs/data/zstd/",
    "/codecs/images/avif/",
    "/codecs/images/jpeg/",
    "/codecs/images/jxl/",
    "/codecs/images/png/",
    "/codecs/images/webp/",
    "/codecs/video/av1/",
    "/codecs/video/avc/",
    "/codecs/video/ffv1/",
    "/codecs/video/hevc/",
    "/codecs/video/vp9/",
    "/containers/matroska/",
    "/containers/mp4/",
    "/containers/webm/",
    "/start-here/lossless/",
    "/start-here/lossy/",
    "/start-here/terminology/",
    "/tools/software-encoders/aomenc/",
    "/tools/software-encoders/rav1e/",
    "/tools/software-encoders/svt-av1/"
  ],
  "checksum": "4293c28f3e72c96d46294d81e489389f9444c552d1b3dc867430c9fc8e66941f",
  "contentFormat": "markdown",
  "markdown": "Media compression is what makes streaming video, music libraries and photo-heavy web pages practical. Uncompressed 1080p video at 24 frames per second in 8-bit 4:2:0 takes roughly 600 Mbit/s; a good AV1 or HEVC encode of the same film looks almost identical at a few Mbit/s. This wiki explains how that works and how to get good results with the tools people actually use.\n\n## What is a codec\n\nA **codec** (coder/decoder) is a way of representing media in compressed form, defined by a specification. H.264, AV1 and Opus are codecs. It helps to keep three things apart:\n\n- The **format** is the standard itself: what a valid compressed stream looks like and how to decode it.\n- An **encoder** is a program that produces such a stream. One format can have many encoders of very different quality and speed: for AV1 there are [SVT-AV1](/tools/software-encoders/svt-av1/), [aomenc](/tools/software-encoders/aomenc/), [rav1e](/tools/software-encoders/rav1e/) and hardware encoders in GPUs.\n- A **decoder** turns the stream back into pictures or sound. For modern video codecs every conforming decoder produces bit-identical pictures from the same stream, so picture quality is decided at encode time.\n\nMost media codecs are **lossy**: they throw away information you are unlikely to notice in exchange for much smaller files (see [lossy compression](/start-here/lossy/)). **Lossless** codecs reconstruct the input exactly and compress far less (see [lossless compression](/start-here/lossless/)).\n\nCodecs exist for each kind of media:\n\n- **Video**: [H.264](/codecs/video/avc/), [HEVC](/codecs/video/hevc/), [VP9](/codecs/video/vp9/), [AV1](/codecs/video/av1/), and lossless formats such as [FFV1](/codecs/video/ffv1/).\n- **Audio**: [Opus](/codecs/audio/opus/), [AAC](/codecs/audio/aac/), [MP3](/codecs/audio/mp3/), and lossless [FLAC](/codecs/audio/flac/).\n- **Images**: [JPEG](/codecs/images/jpeg/), [PNG](/codecs/images/png/), [WebP](/codecs/images/webp/), [AVIF](/codecs/images/avif/) and [JPEG XL](/codecs/images/jxl/). Image formats also have to handle bit depth, transparency, color profiles, HDR and metadata such as EXIF.\n- **General data**: [ZIP](/codecs/data/zip/), [zstd](/codecs/data/zstd/) and similar compressors work on any data, not just media.\n\n## Containers\n\nA video file is usually a **container** holding several compressed streams: video, one or more audio tracks, subtitles, chapters and metadata. [Matroska (MKV)](/containers/matroska/), [MP4](/containers/mp4/) and [WebM](/containers/webm/) are containers, not codecs. Changing the container (**remuxing**) copies the streams without re-encoding them; changing the codec (**transcoding**) decodes and re-encodes, which for lossy codecs always costs some quality.\n\nThe [terminology](/start-here/terminology/) page defines these and other terms in more detail.\n"
}
