LESSON 04 · Encoding and packaging

Make one source fit many screens

Produce compatible renditions and short segments so a player can adapt quality.

SYSTEM VIEW

The video path

Diagram view
Renditions—
Per video hour—
Playing—

Watch one source become a four-rung ladder of 6-second segments, then see a player step down at a boundary.

  1. Video 81’s source sits in Video storage as one MP4 file. MP4 is a container that packages tracks; H.264 is the codec that compresses the video. Devices differ in the codecs, resolutions and bandwidth they support, so no single file suits them all.

    Container
    MP4: packages tracks
    Codec
    H.264: compresses

    What changed

    • v81/source.mp4, one file
    • Devices differ in codec and speed
  2. The Transcoder encodes four renditions, each a resolution at a bitrate: 240p at 0.4 Mbit/s, 480p at 1.5, 720p at 3, 1080p at 6. They total 10.9 Mbit/s, about 4.9 GB per hour of video. More rungs fit better but cost compute and storage; Netflix tunes its ladder per title.

    Ladder
    0.4 · 1.5 · 3 · 6 Mbit/s
    Total
    10.9 Mbit/s

    What changed

    • 4 renditions, 240p to 1080p
    • 4.9 GB stored per hour of video
  3. The Transcoder packages each rendition into independently decodable 6-second segments in Video storage, and publishes a manifest, an index file listing them. Six seconds is Apple’s HLS target: 600 segments per rendition per hour. Very short segments add requests; long ones delay adaptation.

    Segment
    6 s
    Per hour
    600 per rendition

    What changed

    • 6-second segments in each rendition
    • v81 manifest
  4. Every rendition breaks at the same times: 0:00, 0:06, 0:12, 0:18. Segment 0:18 starts at the same moment of the video in 240p as in 1080p, so a player can switch renditions at any boundary and carry on from there.

    Boundaries
    every 6 s
    Aligned in
    all 4 renditions

    What changed

    • Boundaries match in all 4 renditions
  5. The Viewer reads the manifest and plays 720p at 3 Mbit/s. On a train the connection slows, so each 720p segment takes longer to arrive, and the buffer, the seconds of video already downloaded, runs low.

    Playing
    720p at 3 Mbit/s
    Buffer
    running low

    What changed

    • Viewer on a train
    • Buffer runs low on 720p
  6. To protect its buffer, the Viewer takes the next segment, 0:18, from 480p at 1.5 Mbit/s instead of 720p. The boundaries line up, so playback continues from 0:18 without restarting, and each segment now carries half the bits.

    Next segment
    0:18
    From
    480p at 1.5 Mbit/s

    What changed

    • 720p 0:18 not fetched
    • 480p 0:18 plays next
  7. Newer codecs such as AV1 reach similar quality at lower bitrates, but take longer to encode, and not every device decodes them in hardware. So services keep a widely supported codec, H.264, as a fallback.

    AV1
    fewer bits, slower encode
    Fallback
    H.264

    What changed

    • AV1 where devices decode it
    • H.264 kept for the rest
  8. Not every video needs this. A private video shared with three colleagues needs one MP4 file, rather than a ladder of renditions cut into segments to encode and store.

    3 colleagues
    one MP4 file
    Ladder
    not needed

    What changed

    • Private video, one MP4 file
    • No ladder to encode or store

Space plays · ← → step · Home resets

THE IDEA

How it works

A container such as MP4 packages tracks; a codec such as H.264 compresses video. Devices differ in supported codecs, resolutions, and bandwidth. Encode a deliberately limited ladder of renditions, meaning bitrate and resolution combinations, where bitrate is the data used per second of video. More renditions improve fit but cost compute and storage.

As an example, 240p at 0.4 Mbit/s, 480p at 1.5, 720p at 3, and 1080p at 6 total 10.9 Mbit/s, so each hour of video stores about 4.9 GB. Netflix’s per-title encoding work showed that one fixed ladder wastes bits on simple content and can fall short on complex content, so it tunes the ladder per title.

Package each rendition into short, independently decodable segments and publish a manifest, an index file listing them. Align segment boundaries so the player switches quality cleanly. HLS and MPEG-DASH are HTTP-based playback approaches; choose against actual client compatibility. On a changing mobile connection, the player can request a lower-bitrate next segment to protect its buffer, the seconds of video already downloaded. Very short segments add requests; long ones delay adaptation and may waste bytes. Apple’s HLS guidance targets six seconds, which means 600 segments per rendition per hour.

Newer codecs such as AV1 reach similar quality at lower bitrates but take longer to encode, and not every device decodes them in hardware, so services keep a widely supported codec such as H.264 as a fallback. A private video shared with three colleagues needs one MP4 file rather than a ladder.

DECISION POINT

A viewer moves from Wi-Fi to a slow train connection halfway through a video. What prepared assets enable a quality change?

Write a sentence or two to unlock the guidance. Committing first is what makes it stick.

Keep in mind

  • Codec, container, bitrate, rendition, segment, and manifest solve different problems.
  • Align segment boundaries and choose the rendition ladder for supported devices.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 3
RecallQUESTION 01

What is a playback manifest for?

Choose an answer. You’ll see the explanation once you get it right.

Next lesson

0 of 3 checkpoints answered correctly to complete this lesson.