Why Video Is Its Own Problem
scale of bytes:
webpage: ~2MB
5-min 1080p: ~400MB (200x a webpage!)
1M concurrent viewers × 5Mbps = 5 Tbps egress
no origin fleet serves this. video delivery is a CDN-native
workload — the architecture exists to make one upload
serve millions.
The Segmenting Foundation
never stream a file; stream SEGMENTS (2-10s chunks):
upload → transcode → segments → packaged
master.m3u8 (playlist) + seg_001.ts, seg_002.ts, ...
why segments win:
- each is an independent cacheable URL
- players fetch ahead (buffering tolerance)
- adaptive switching between qualities mid-stream
- CDN-friendly: immutable files, power-law popularity
Adaptive Bitrate Streaming (ABR)
same content encoded at multiple bitrates:
1080p @ 5Mbps ─┐
720p @ 2.5Mbs ─┼─► player picks per CURRENT bandwidth/device:
480p @ 1Mbps ─┤ bandwidth drops → switch DOWN seamlessly
360p @ 0.6Mbps ┘ recovers → switch UP
user experience: quality flexes instead of buffering.
the playlist (m3u8) describes the ladder; player logic
measures throughput and chooses continuously.
The CDN Economics
VOD (on-demand):
segment popularity = power law → hit rates >99%
origin sees ~1 fetch per segment per region, EVER
1M viewers cost origin almost NOTHING extra
LIVE:
sliding window of recent segments, short TTLs (~segment duration)
every viewer hits the same current segments simultaneously:
1M viewers × same 3 segments = massive fan-out at edges,
but STILL only ~1 origin fetch per segment (with shielding)
live latency floor ≈ segment length + buffer:
standard HLS: 15-30s LL-HLS: 2-5s WebRTC sub-second
Upload and Transcode Pipeline
creator uploads → object storage
│ event
▼
transcode workers (queue-driven)
- multiple resolutions/bitrate ladder
- thumbnail/sprite generation
- packaging (HLS+DASH manifests)
│
▼
publish to origin/CDN, invalidate nothing
(new unique paths)
transcoding is compute-heavy batch work: queue-based
scaling, minutes-long latency tolerated by design.
Interview Framing
“Design YouTube/video platform” scored skeleton: object storage for originals, queued transcoding to ABR ladders, segment-based packaging (HLS/DASH named), CDN delivery with shield math (“origin sees one fetch per segment”), player-side adaptive logic, and live-vs-VOD distinction (sliding window TTLs). Numbers matter here more than usual — quote the 5Tbps-style arithmetic to show you grasp why the architecture looks like it does.
Premium Content
Unlock Video Delivery and all premium lessons with a subscription.
All premium lessons
Ad-free experience
Priority support
From ₹199.99/year — See plans