Video Streaming (YouTube)

Hard Media

Overview

Designing a Video Streaming platform (YouTube, Netflix) is a complex system design question that tests CDN usage, adaptive bitrate streaming, and handling massive media files. The core challenges include: storing and serving petabytes of video, transcoding into multiple resolutions/bitrates, and delivering smooth playback globally with low latency. This design matters in interviews because it combines object storage, transcoding pipelines, CDNs, and client-side logic—and requires thinking about cost (egress, storage) and quality of experience. Demonstrating you understand HLS/DASH, chunked uploads, and how to scale transcoding shows you can design systems for media at scale.

Requirements

Functional

  • Upload videos (support large files, resumable)
  • Transcode into multiple resolutions (240p–4K)
  • Adaptive bitrate streaming (HLS/DASH)
  • Video playback with low startup time
  • Thumbnails, metadata, search
  • Live streaming (optional)

Non-Functional

  • Low latency — video start <2 seconds
  • High availability — 99.99%
  • Global distribution — CDN edge caching
  • Cost efficiency — minimize egress and storage

Capacity Estimation

Assume 500 hours uploaded/day, 1B views/day. 500 * 5GB = 2.5TB upload/day. 1B * 500MB avg stream = 500PB egress/day (mitigated by CDN).

Architecture Diagram

ClientsUpload ServiceTranscoderMetadata DBStreaming SvcObject StoreCDN EdgeManifest Svc

Component Deep Dive

Upload Service

Chunked upload (multipart). Assembles chunks, stores in object store. Initiates transcoding job.

Transcoding Pipeline

FFmpeg or cloud transcoder. Produces multiple resolutions, HLS/DASH manifests. Parallel workers.

Object Store

S3/GCS. Stores raw uploads, transcoded segments, thumbnails. Versioned for durability.

CDN

CloudFront, Cloudflare. Caches video segments at edge. Reduces origin load and latency.

Metadata Service

Video metadata, user data, playlists. PostgreSQL/Cassandra. Powers search and recommendations.

Streaming Service

Serves HLS/DASH manifests and segments. Redirects to CDN URL. Handles range requests.

Database Design

Videos: video_id, user_id, title, status, created_at. Segments: video_id, resolution, segment_url. Users, playlists in PostgreSQL. Segment URLs point to CDN.

API Design

MethodPathDescription
POST/api/upload/initInitiate upload. Returns upload_id, chunk_urls.
PUT/api/upload/{id}/chunkUpload chunk. Multipart.
POST/api/upload/{id}/completeFinalize upload. Triggers transcoding.
GET/api/videos/{id}/streamGet HLS/DASH manifest. Returns .m3u8 or .mpd URL.
GET/api/videos/{id}Get video metadata.

Scalability & Trade-offs

Related System Designs