Skip to main content
← CONCEPTS / SYSTEM-DESIGN
An end-to-end domain learning journey

Adaptive Bitrate Streaming (HLS/DASH)
& Distributed Transcoding DAGs.

Adaptive Bitrate (ABR) streaming encodes video into aligned 2–4 second GOP segments across a multi-resolution bitrate ladder so players can switch quality mid-playback without rebuffering.
Start the journey7 sections· Last modified Nov 24, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

To keep the architecture evolvable without sacrificing reliability, splitting mezzanine 4K masters at Group of Pictures (GOP) keyframes into a parallel Transcoding DAG cuts encoding latency from days to minutes while enabling seamless HLS/DASH ABR switching.

TL;DR30-second simplified summary
▾

Studio masters are split at IDR keyframes and encoded across an ABR ladder via a parallel transcoding DAG. Shared CMAF segments and two-tier HLS/DASH manifests let clients adapt bitrate smoothly using EWMA throughput + buffer depth.

Full walkthrough · 7 stages
01
foundation

Why Progressive MP4 Download Fails on Variable Networks.

Why this matters: Understand why a single-bitrate file causes either rebuffering stalls or wasted bandwidth.

Think of Why Progressive MP4 Download Fails on Variable Networks as the intuition layer for Adaptive Bitrate Streaming (HLS/DASH) & Distributed Transcoding DAGs: Understand why a single-bitrate file causes either rebuffering stalls or wasted bandwidth.

Progressive download of a single 8 Mbps 1080p file stalls whenever a user's cellular throughput drops to 3 Mbps, while serving 480p to fiber users wastes 4K capability. Without chunked segments and an index manifest, a player cannot switch quality mid-stream without restarting playback.

FOUNDATION

Single-Bitrate Stall vs. ABR

Single 8 Mbps MP4riskBandwidth Drop -> 2MbpscomputePlayback StallriskStoretriggers spinner freeze

1.Bandwidth Volatility: Mobile throughput can swing 10x within 5 seconds.

2.Seek Waste: Progressive download buffers ahead bytes the user may never watch.

Single-bitrate progressive video cannot adapt to mid-stream bandwidth drops.

02
foundation

IDR Keyframes & GOP-Aligned Video Splitting.

Why this matters: Slice raw mezzanine video on Instantaneous Decoder Refresh (IDR) frames for independent segment decoding.

Video codecs (H.264, HEVC, AV1) use inter-frame compression: P-frames and B-frames reference earlier frames.

Cutting at an arbitrary timestamp breaks decoding.

FOUNDATION

Closed-GOP Keyframe Alignment

4K Mezzanine MasteringressKeyframe SplittercomputeClosed GOP ChunksoutputStoreemits independent chunks

1.Aligned Cuts: Every rung in the ABR ladder MUST align its IDR keyframes at the exact same timestamps.

2.CDN Cacheability: Immutable 2-4s segments achieve >95% edge cache hit ratios.

Closed-GOP segmentation ensures every quality rung can switch cleanly at segment boundaries.

Engineering Decision Framework
Problem
How to implement Adaptive Bitrate Streaming (HLS/DASH) & Distributed Transcoding DAGs without hitting unbounded tail latency, state divergence, or operational fragility.
Naive Solution
Use a single unpartitioned path with unbounded retries and synchronous global coordination.
Why It Fails
Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
Alternatives
Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
Engineering Decision
To keep the architecture evolvable without sacrificing reliability, splitting mezzanine 4K masters at Group of Pictures (GOP) keyframes into a parallel Transcoding DAG cuts encoding latency from days to minutes while enabling seamless HLS/DASH ABR switching.
Trade-Offs
Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
Decision Exercise · Make the Call

When Adaptive Bitrate Streaming (HLS/DASH) & Distributed Transcoding DAGs experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?

03
intermediate

Parallel Distributed Transcoding DAG.

Why this matters: Turn a 6-hour single-machine encode into a 5-minute parallel map-reduce DAG.

Think of Parallel Distributed Transcoding DAG as the intuition layer for Adaptive Bitrate Streaming (HLS/DASH) & Distributed Transcoding DAGs: Turn a 6-hour single-machine encode into a 5-minute parallel map-reduce DAG.

Encoding a 2-hour 4K movie on one CPU takes hours. A Transcoding Orchestrator models the job as a DAG: (1) inspect & split mezzanine into 1,800 GOP chunks, (2) fan out chunk × bitrate_rung tasks to parallel FFmpeg workers, (3) run VMAF perceptual quality checks, and (4) package HLS/DASH manifests.

INTERMEDIATE

Map-Reduce Transcoding DAG

GOP SplitteringressFFmpeg Worker FleetcomputeManifest PackageroutputStoremerges encoded .m4s segments

1.Spot Fleet: Stateless chunk tasks retry cleanly on spot-instance preemption.

2.Per-Title Encoding: Complex action scenes get higher bitrates than static animation.

A chunk-parallel DAG scales video encoding horizontally across hundreds of stateless workers.

04
intermediate

HLS (`.m3u8`) & MPEG-DASH (`.mpd`) Manifest Structure.

Why this matters: Expose available bitrates, codecs, and byte-range/segment URLs in a two-level manifest.

Think of HLS (.m3u8) & MPEG-DASH (.mpd) Manifest Structure as the intuition layer for Adaptive Bitrate Streaming (HLS/DASH) & Distributed Transcoding DAGs: Expose available bitrates, codecs, and byte-range/segment URLs in a two-level manifest.

Both HLS and DASH use a two-tier manifest: a Master Playlist listing every variant stream (1080p @ 5.8 Mbps, 720p @ 3.0 Mbps, 480p @ 1.4 Mbps) plus audio/subtitle tracks, and Media Playlists mapping segment sequence numbers to CDN URLs.

INTERMEDIATE

Two-Tier HLS/DASH Manifests

Master ManifestingressMedia PlaylistcomputeCDN SegmentsoutputStorefetches next 4s segment

1.Demuxed A/V: Audio and video tracks are packaged separately so languages don't duplicate video.

2.CMAF Convergence: CMAF `.m4s` segments work for both HLS and DASH, halving CDN storage.

Two-tier manifests and CMAF segments let one CDN cache serve both Apple HLS and DASH players.

05
intermediate

Client ABR Controller: Throughput vs. Buffer-Based (BBA).

Why this matters: Balance high visual quality against rebuffering risk using hybrid throughput + buffer-level heuristics.

Pure throughput-based ABR oscillates wildly on noisy Wi-Fi.

Pure buffer-based ABR (BBA) reacts too slowly on startup.

INTERMEDIATE

Hybrid ABR Rung Selection

EWMA ThroughputingressBuffer OccupancygateRung SelectoroutputStoreselects safe bitrate rung

1.Safety Margin: Targeting 80-85% of estimated bandwidth absorbs micro-bursts.

2.No Oscillation: Hysteresis prevents ping-ponging between 720p and 1080p every 4s.

Combining smoothed throughput with buffer occupancy prevents both stalls and quality flicker.

06
advanced

Multi-DRM Packaging (Widevine, FairPlay, PlayReady) & CENC.

Why this matters: Encrypt segments once with Common Encryption (CENC) and serve per-platform license keys.

Think of Multi-DRM Packaging (Widevine, FairPlay, PlayReady) & CENC as the intuition layer for Adaptive Bitrate Streaming (HLS/DASH) & Distributed Transcoding DAGs: Encrypt segments once with Common Encryption (CENC) and serve per-platform license keys.

Re-encrypting video separately for Chrome (Widevine), Safari (FairPlay), and Edge (PlayReady) triples CDN storage and wrecks cache hit rates. Common Encryption (CENC) encrypts .m4s segments once using AES-128 CTR/CBCS and attaches PSSH boxes so any DRM client fetches only a tiny license key from the License Server.

ADVANCED

Shared CENC Segments + Multi-DRM

CENC AES-128SegmentsstorageDRM License ServersecurityEME / CDM PlayeroutputStoredelivers wrapped CEK

1.1x CDN Footprint: All DRM ecosystems share the exact same cached CENC segments.

2.Hardware TEE: Keys stay inside the device's Trusted Execution Environment.

Common Encryption (CENC) preserves 1x CDN caching across Widevine, FairPlay, and PlayReady.

07
advanced

Per-Title Shot-Based Encoding & VMAF Optimization.

Why this matters: Cut CDN egress by 20-35% by tailoring bitrate ladders to each title's visual complexity.

Think of Per-Title Shot-Based Encoding & VMAF Optimization as the intuition layer for Adaptive Bitrate Streaming (HLS/DASH) & Distributed Transcoding DAGs: Cut CDN egress by 20-35% by tailoring bitrate ladders to each title's visual complexity.

A static 5.8 Mbps 1080p ladder wastes bits on simple cartoons while starving grainy dark action scenes. Per-title/per-shot encoding measures VMAF perceptual quality across sample encodes and builds a custom convex-hull bitrate ladder per title, delivering identical visual quality at ~30% lower bandwidth.

ADVANCED

VMAF Convex-Hull Ladder

Shot ComplexityProbeingressVMAF Quality ScorercomputeCustom ABR LadderoutputStoreemits Pareto-optimal rungs

1.30% Egress Savings: Lower bitrates for simple scenes save petabytes of ISP bandwidth.

2.Consistent QoE: Viewers on slow links get higher clarity at 720p/480p.

VMAF-driven per-title ladders optimize visual quality per bit rather than using fixed bitrates.

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why must every quality rung (1080p, 720p, 480p) in an ABR ladder place IDR keyframes at the exact same timestamps?

Recommended Learning Flow