Skip to main content
Media & Streaming

Design Global Video Streaming & Transcoding Pipeline (YouTube / Netflix)

Staff / Principal

Architect a globally distributed video streaming system handling petabyte-scale storage, asynchronous chunked transcoding (HLS / DASH), CDN.

Production Scale: 2 Billion DAU • 1M+ Video Uploads/Day • 500 Gbps Ingress

Design Global Video Streaming & Transcoding Pipeline (YouTube / Netflix): Request Topology

4 Stages · 4 Sizing Benchmarks

Request traversal order for Design Global Video Streaming & Transcoding Pipeline (YouTube / Netflix) (Media & Streaming) under target workload 2 Billion DAU • 1M+ Video Uploads/Day • 500 Gbps Ingress:

Stage 1

Upload Service & Chunking

Stage 2

Transcoding Pipeline (DAG)

Stage 3

Global Edge CDN (Cloudflare/CloudFront)

Stage 4

Metadata & Search Cluster

Functional Requirements

  • •Upload video files up to 10GB
  • •Adaptive Bitrate (ABR) video playback across resolutions (360p to 4K)
  • •Global search and view count tracking

Non-Functional Requirements

  • •High availability (99.99%)
  • •Ultra-low buffering latency (<200ms TTFB)
  • •Zero data loss for uploaded media

Capacity & Scale Estimation (Back-of-the-Envelope Math)

Open Live Calculator
Daily Active Users (DAU)2 Billion Users
Daily Video Uploads1,000,000 videos / day (~500 TB/day)
Streaming Bandwidth20 Petabytes / hour (Peak CDN egress)
Storage Required (5 Yrs)~900 Petabytes of replicated blob storage

Estimate Custom QPS & Storage Growth Live

Calculate bandwidth ingress, 80/20 RAM cache sizing, and multi-year storage growth using our interactive developer utility.

Launch Calculator →

System Topology & Core Architectural Components

+---------------------------------------------------------------------------------------------------+
| [CLIENTS] Web Video Player / Smart TV / Mobile Apps (Adaptive Bitrate HLS / MPEG-DASH)             |
+-------------------------------------------------+-------------------------------------------------+
                                                  |
                                                  v
+-------------------------------------------------+-------------------------------------------------+
| [MULTI-CDN EDGE NETWORK] Cloudflare / Fastly / Google Edge PoPs (Cached Video Chunks .m4s / .ts)   |
+-------------------------------------------------+-------------------------------------------------+
                                                  | (Cache Miss / Origin Request)
                                                  v
+-------------------------------------------------+-------------------------------------------------+
| [VIDEO INGESTION & TRANSCODING PIPELINE]                                                          |
| - Asynchronous Chunk Splitting & Parallel Transcoding Fleet (FFmpeg on GPU Instances)             |
| - Multi-Resolution Encoding: 1080p, 4K, 720p, 480p, AV1, VP9, H.264 Standards                     |
+-------------------------------------------------+-------------------------------------------------+
                                                  |
                                                  v
+-------------------------------------------------+-------------------------------------------------+
| [STORAGE & METADATA LAYER] Google Colossus / S3 Blob Storage | Spanner Database for Video Metadata |
+---------------------------------------------------------------------------------------------------+

1Upload Service & Chunking

Receives multi-part file chunks, uploads to temporary S3 staging bucket, and triggers async transcoding event to Kafka.

2Transcoding Pipeline (DAG)

Distributed worker pool (FFmpeg) splits video into 6-second segments, encodes into multiple resolutions (AV1/H.265), and outputs HLS/DASH manifest (.m3u8).

3Global Edge CDN (Cloudflare/CloudFront)

Caches video segments at regional edge points of presence (PoPs) to serve 95%+ of video bytes without hitting origin servers.

4Metadata & Search Cluster

PostgreSQL for transactional metadata + Elasticsearch cluster for sub-second video search indexing.

Architectural Trade-Off Analysis & CAP Constraints

Trade-Off Decision Matrix

Engineering a resilient architecture for Design Global Video Streaming & Transcoding Pipeline (YouTube / Netflix) at a scale of 2 Billion DAU • 1M+ Video Uploads/Day • 500 Gbps Ingress requires deliberate trade-offs across data consistency, replication latency, network partition tolerance, and storage economics:

DimensionSelected StrategyAlternative EvaluatedTrade-Off Rationale & Latency Impact
CAP Theorem PostureAP for Video Edge Delivery & Catalog vs. CP for Video Metadata & OwnershipCP (Strict Consistency across Global Video Views & Playlists)Video streaming demands 99.999% playback availability across global CDNs; viewing counts, recommendations, and search indexing tolerate eventual consistency delays of several seconds to minutes.
Streaming Delivery ProtocolAdaptive Bitrate Streaming (HLS & MPEG-DASH)Progressive HTTP MP4 File DownloadDynamically adjusts video resolution and bitrate based on client network bandwidth, eliminating buffering pauses.
Transcoding ArchitectureAsynchronous Chunked Distributed TranscodingMonolithic Single-Server Video EncodingSplits a 2-hour 4K video into 5-second segments encoded simultaneously across 50 GPU worker nodes in parallel.
Video Chunk StorageErasure-Coded Distributed Blob StorageReplicated Raw File Systems (RAID)Reed-Solomon (8+4) erasure coding guarantees durability against complete datacenter outages with only 50% storage overhead.
Metadata Database PostureGoogle Cloud Spanner (CP with TrueTime)NoSQL MongoDB ClusterEnforces globally consistent video view counts, subscriber state, and monetization rights without transactional read anomalies.

Fault Tolerance, High Availability & Failure Mode Analysis

Operating at 2 Billion DAU • 1M+ Video Uploads/Day • 500 Gbps Ingress demands proactive defenses against cascading outages. The blueprint specifies four critical failure modes and remediation protocols tailored to Design Global Video Streaming & Transcoding Pipeline (YouTube / Netflix):

1. Viral Video CDN Cache Invalidation Storm

Blast Radius: A breaking news video receives 50M views in 1 hour, overwhelming the origin storage tier.

Remediation Protocol: Origin shields and CDN request collapsing ensure only a single master request fetches cold chunks from storage.

2. Transcoding Node GPU Crash during Processing

Blast Radius: A video segment fails mid-encode, causing an incomplete master manifest.

Remediation Protocol: Task queues track chunk timeouts, reassigning dropped segments to standby worker nodes automatically.

3. Corrupted Chunk Upload from Unstable Client

Blast Radius: Uploaded video file contains invalid codec headers, causing encoding panics.

Remediation Protocol: Initial ingest validation probe inspects MP4 atom containers before passing files to the heavy transcode cluster.

4. Copyright Content ID Match Spike

Blast Radius: Automated audio fingerprint matching creates heavy CPU bottlenecks during upload bursts.

Remediation Protocol: Fingerprint analysis runs as an independent asynchronous priority queue without blocking basic video playback.

Production Algorithm Implementation: HLS Master Playlist M3U8 Manifest Generator

TypeScript

High-scale distributed systems rely on atomic synchronization primitives to enforce SLA boundaries. Below is the production implementation for Design Global Video Streaming & Transcoding Pipeline (YouTube / Netflix):

// HLS Adaptive Bitrate Master Playlist Generator
interface StreamVariant {
  bandwidth: number;
  resolution: string;
  codecs: string;
  url: string;
}

export function generateHlsMasterPlaylist(variants: StreamVariant[]): string {
  let manifest = '#EXTM3U\n#EXT-X-VERSION:6\n';
  for (const v of variants) {
    manifest += `#EXT-X-STREAM-INF:BANDWIDTH=${v.bandwidth},RESOLUTION=${v.resolution},CODECS="${v.codecs}"\n${v.url}\n`;
  }
  return manifest;
}

Design Global Video Streaming & Transcoding Pipeline (YouTube / Netflix): Design Scope & Constraints Summary

This staff / principal blueprint balances 3 core functional workflows against 3 availability and latency constraints tailored for 2 Billion DAU • 1M+ Video Uploads/Day • 500 Gbps Ingress. Review the FAQ trade-offs below to compare partitioning keys, replication topology, and failure isolation specific to Media & Streaming.

Architectural FAQs & Interview Deep Dives

1Why does the transcoding DAG split raw uploads on GOP boundaries before encoding multiple resolutions?

Encoding a 10 GB 4K upload sequentially on one worker would delay playback availability for hours. By splitting the source stream at Group of Pictures (GOP) keyframes into independent chunks, a DAG scheduler fans chunks out across thousands of stateless FFmpeg workers in parallel to produce AV1/H.265 renditions in minutes while keeping keyframes aligned across every bitrate tier.

2How do Adaptive Bitrate (ABR) players switch cleanly between 360p and 4K mid-stream without stuttering?

Each transcoded rendition shares identical 6-second segment boundaries starting on IDR keyframes and indexed in HLS (`.m3u8`) or DASH (`.mpd`) manifests. The player continuously measures download throughput and local playback buffer depth, fetching the highest-quality next segment whose download time fits safely inside the remaining buffer.

3How does the global CDN tier sustain 20 PB/hour of streaming egress during viral premieres without overloading origin storage?

Edge PoPs cache hot 6-second video segments in NVMe/RAM, serving 95%+ of bytes locally. When a newly published segment misses at hundreds of edge PoPs simultaneously, an intermediate regional Origin Shield coalesces identical upstream requests into a single fetch against replicated blob storage.

4How are real-time view counts tracked accurately without turning viral video rows in PostgreSQL into lock bottlenecks?

Playback start events stream into Kafka rather than updating relational rows synchronously. Stateful stream aggregators deduplicate replay spam using sliding IP/session windows, accumulate per-video count deltas in memory, and flush batched increments to PostgreSQL and Elasticsearch every few seconds.