Design Netflix — Video Streaming Architecture
Designing Netflix means building a system that ingests raw video, transcodes it into hundreds of formats, stores it efficiently, delivers it globally with minimal buffering, and recommends content to 250 million subscribers.
What You’ll Learn
You’ll master video transcoding pipelines, CDN edge caching, recommendation system architecture, and adaptive bitrate streaming. You’ll build a complete Netflix video pipeline.
Why This Problem Matters
Netflix dominates 35% of global internet traffic during peak hours. Its architecture is a masterclass in content delivery at planetary scale — from studio ingestion to your living room. At DodaTech, content delivery patterns from Netflix optimize video playback in Doda Browser.
Video Pipeline
flowchart LR
Studio[Studio Upload] -->|Master File| Ingest[Ingestion Service]
Ingest --> Queue[Job Queue]
Queue --> W1[Worker: Transcode 1080p/H.264]
Queue --> W2[Worker: Transcode 4K/H.265]
Queue --> W3[Worker: Transcode Audio/AAC]
Queue --> W4[Worker: Generate Thumbnails]
W1 --> Storage[(Object Storage - S3)]
W2 --> Storage
W3 --> Storage
W4 --> Storage
Storage --> CDN[Open Connect CDN]
User[User Playback] -->|GET /manifest.m3u8| CDN
User -->|Adaptive segments| CDN
Video Transcoding
Raw video from studios (huge files, proprietary formats) must be transcoded into streaming-ready formats:
| Aspect | Source File | Streamable File |
|---|---|---|
| Codec | ProRes, DNxHD, RAW | H.264, H.265, AV1 |
| Resolution | Up to 8K | Multiple: 360p, 480p, 720p, 1080p, 4K |
| Bitrate | 1-10 Gbps | Adaptive: 235 Kbps to 15 Mbps |
| Audio | Multi-channel PCM | AAC stereo, Dolby Atmos, 5.1 |
| Size | 100+ GB per hour | Segmented into 5-second .ts chunks |
Adaptive Bitrate Streaming (ABR)
Netflix uses HLS (HTTP Live Streaming) or MPEG-DASH:
manifest.m3u8
├── 360p.m3u8 (video/segment_001.ts, segment_002.ts, ...)
├── 480p.m3u8
├── 720p.m3u8
├── 1080p.m3u8
├── 4K.m3u8
└── audio.m3u8 (AAC audio segments)The client requests segments based on current bandwidth:
def select_bitrate(bandwidth: float, available_bitrates: list) -> str:
"""Choose the highest bitrate that is below current bandwidth."""
sorted_rates = sorted(available_bitrates, key=lambda r: r.bandwidth)
best = sorted_rates[0]
for rate in sorted_rates:
if rate.bandwidth < bandwidth * 0.8: # 80% threshold
best = rate
else:
break
return best.urlOpen Connect CDN
Netflix built its own CDN (Open Connect) instead of relying on third parties:
- ISP Appliances: Free caching servers installed inside ISP data centers
- Edge Nodes: Regional caching points close to users
- Origin: Netflix’s own AWS-based storage
When you press play:
- Client requests manifest from Open Connect appliance
- Appliance serves cached segments if available
- On cache miss, fetches from parent node or origin
- Client adaptively switches between bitrates
Recommendation System
Netflix’s recommendation engine is a multi-stage pipeline:
- Candidate generation: Collaborative filtering (users like you watched X) + content-based (you watched dramas, here are more dramas)
- Ranking: Neural network scores candidates based on likelihood to watch
- Context filtering: Remove already-watched, apply parental controls
- A/B testing: Serve different rankings to test groups
User Profile → [User Features] → [Item Features] → [Model Inference]
↓ ↓
[Watch History] → [Collaborative Filter] → [Candidate Pool]
↓ ↓
[Content Graph] → [Content-Based Filter] → [Ranked Candidates]Common Mistakes
1. Single Resolution Transcoding
Streaming only one resolution guarantees bad UX — users with slow connections buffer, users with fast connections get poor quality. Always generate multiple bitrates.
2. Storing Video on Application Servers
Video files are enormous. Use object storage (S3, GCS) with lifecycle policies. Never store media on the application server’s disk.
3. No CDN for Video Delivery
Serving video from origin servers overloads them and increases latency. Use CDN with edge caching. Netflix’s Open Connect appliances cache at ISP level.
4. Synchronous Transcoding
Transcoding a 2-hour movie takes hours. Never process video in the request thread. Use async job queues (SQS, RabbitMQ) with worker pools.
5. Ignoring Bitrate Switching Latency
ABR algorithms must switch bitrates smoothly without interrupting playback. Use gradual transitions and maintain a buffer of 3-5 seconds.
6. No Geo-Aware Content Placement
Popular content should be cached at all edge nodes. Niche content can live at regional nodes. Use content popularity metrics for placement decisions.
7. Forgetting DRM
Content protection is mandatory. Implement Widevine (Android/Chrome), FairPlay (iOS), and PlayReady (Xbox/Windows). Encrypt segments and deliver keys separately.
Practice Questions
1. What is adaptive bitrate streaming?
The client requests video segments at different quality levels based on current bandwidth, switching seamlessly as network conditions change.
2. Why did Netflix build Open Connect instead of using a commercial CDN?
At Netflix’s scale (35% of internet traffic), commercial CDNs are cost-prohibitive. Open Connect appliances inside ISP networks reduce latency and bandwidth costs.
3. What’s the purpose of transcoding video into multiple resolutions?
To support adaptive bitrate streaming — users with slow connections watch 360p, users with fast connections watch 4K, without buffering.
4. How does Netflix’s recommendation system work?
Candidate generation (collaborative + content-based filtering) → neural network ranking → context filtering → A/B testing.
5. Challenge: Design the search feature.
Implement prefix search for titles. Use Elasticsearch with n-gram tokenizer. Rank by popularity and relevance. Add autocomplete with top 10 suggestions.
Mini Project: Video Manifest Generator
Build a service that:
- Accepts a video ID and available resolutions
- Generates an HLS manifest (
.m3u8) referencing all quality levels - Simulates transcoding with a job queue (store segments as files)
- Serves segments via a simple HTTP server
- Includes a basic ABR selector based on simulated bandwidth
What’s Next
Congratulations on completing this Netflix design! Here’s where to go from here:
- Practice daily — Design one video pipeline component per day
- Build a project — Implement a basic ABR player
- Explore related topics — Video codecs, DRM, CDN architecture
- Join the community — Share your designs and get feedback
Remember: every expert was once a beginner. Keep designing!
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro