โ† Back to All Questions
Hard~75 minStreaming & Video

Design YouTube/Netflix - Video Streaming Platform

GoogleNetflixAmazon PrimeDisney+MetaTikTokTwitch

๐Ÿ“ Problem Description

Design a video streaming platform like YouTube or Netflix that allows users to upload, process, and stream videos. The system should support adaptive bitrate streaming, global content delivery, recommendations, and handle billions of daily video views with minimal buffering.

๐Ÿ‘ค Use Cases

1.
Creator wants to upload a video so that the video is processed and made available for streaming
2.
Viewer wants to search for videos so that they find relevant content
3.
Viewer wants to play a video so that they watch with minimal buffering
4.
Viewer wants to switch video quality so that stream adapts to their bandwidth
5.
Viewer wants to like, comment, subscribe so that their engagement is recorded
6.
System wants to recommend videos so that personalized content for each user

โœ… Functional Requirements

  • โ€ขUpload videos (up to 12 hours, various formats)
  • โ€ขTranscode videos to multiple resolutions (144p to 4K)
  • โ€ขStream videos with adaptive bitrate (ABR)
  • โ€ขSearch videos by title, description, tags
  • โ€ขRecommend personalized content
  • โ€ขSupport live streaming
  • โ€ขEngagement features: likes, comments, subscriptions
  • โ€ขMonetization: ads insertion

โšก Non-Functional Requirements

  • โ€ขVideo start time (time to first byte) < 200ms
  • โ€ขMinimal buffering (< 1% rebuffer rate)
  • โ€ขSupport 5 billion video views per day
  • โ€ข500 hours of video uploaded per minute
  • โ€ขGlobal availability with low latency
  • โ€ขHigh durability - never lose uploaded content

โš ๏ธ Constraints & Assumptions

  • โ€ขVideo upload size: up to 256GB
  • โ€ขMaximum video duration: 12 hours
  • โ€ขTranscode to 6+ quality levels (144p, 240p, 360p, 480p, 720p, 1080p, 4K)
  • โ€ขThumbnail extraction at multiple timestamps
  • โ€ขGlobal CDN coverage in 100+ countries

๐Ÿ“Š Capacity Estimation

๐Ÿ‘ฅ Users
2B monthly active users, 1B daily views
๐Ÿ’พ Storage
1 exabyte total, 500PB/year new content
โšก QPS
Video plays: 50K/sec, Uploads: 1K/min
๐ŸŒ Bandwidth
100+ Tbps global egress
๐Ÿ“ Assumptions
  • โ€ข 5B video views per day
  • โ€ข 500 hours uploaded per minute = 720K hours/day
  • โ€ข Average video: 10 minutes, 500MB after encoding
  • โ€ข 80% of traffic goes to 20% of videos (hot content)
  • โ€ข Average viewer watches 40 minutes/day
  • โ€ข 6 encoding profiles per video

๐Ÿ’ก Key Concepts

CRITICAL
Adaptive Bitrate Streaming
HLS/DASH protocols allow clients to switch quality based on network conditions. Video is split into small segments (2-10s) at multiple quality levels.
CRITICAL
CDN Edge Caching
90%+ of video requests served from edge cache. Popular content is pre-positioned at edge nodes. Cache hit rate directly impacts latency and cost.
CRITICAL
Video Transcoding
Convert source video to multiple profiles (codec, resolution, bitrate). Parallel processing for speed. FFmpeg is the standard tool.
HIGH
Chunked Upload
Large files uploaded in resumable chunks. Allows retry on failure, parallel upload. Direct to S3 with pre-signed URLs.
HIGH
Video Segmentation
Videos split into small segments (2-10s) for streaming. Enables seeking, quality switching, and efficient caching.
MEDIUM
Hot vs Cold Content
80% of views go to 20% of videos. Hot content cached aggressively. Cold content may stream from origin.

๐Ÿ’ก Interview Tips

  • ๐Ÿ’กSeparate upload/processing path from viewing path early
  • ๐Ÿ’กExplain adaptive bitrate streaming in detail - it's core to video
  • ๐Ÿ’กDiscuss CDN extensively - it handles 90%+ of traffic
  • ๐Ÿ’กMention transcoding pipeline parallelism
  • ๐Ÿ’กCover the hot vs cold content distinction
  • ๐Ÿ’กDraw the video segment structure (HLS/DASH)