System Design FAQ: Top Questions
10. How would you design a Video Streaming Platform (like YouTube or Netflix)?
A Video Streaming Platform allows users to upload, encode, store, and stream videos on-demand or live. It must deliver high performance, fault tolerance, and adaptability to varying network conditions.
📋 Functional Requirements
- Upload and store video content
- Stream videos with adaptive quality
- Support recommendations, comments, and metadata
📦 Non-Functional Requirements
- High availability and performance
- Scalable to millions of users
- Low latency and buffering time
🏗️ High-Level Architecture
- Frontend: HTML5 video player, video search UI
- Upload Service: Accepts and validates video files
- Encoding Service: Transcodes videos into multiple resolutions
- CDN: Delivers video chunks globally with low latency
- Storage: Blob store like AWS S3 for original and encoded files
- Database: Stores metadata (PostgreSQL, DynamoDB)
🎬 Video Transcoding Pipeline
- Upload triggers a message to SQS/Kafka
- Encoding jobs transcode into 240p, 480p, 720p, 1080p
- Save HLS (HTTP Live Streaming) segments to S3
🔧 FFmpeg Command Example
ffmpeg -i input.mp4 -profile:v baseline -level 3.0 -s 640x360 -start_number 0 \
-hls_time 10 -hls_list_size 0 -f hls 360p.m3u8
🌍 CDN Caching (CloudFront example)
- Cache HLS segments (.ts) and playlists (.m3u8)
- Edge-optimized delivery with signed URLs
🗃️ Video Metadata Table
CREATE TABLE videos (
video_id UUID PRIMARY KEY,
title TEXT,
user_id UUID,
description TEXT,
resolutions TEXT[],
upload_time TIMESTAMP,
views BIGINT DEFAULT 0,
duration INT
);
📈 Observability Metrics
- Encoding latency and success rates
- Stream start time and buffer underruns
- Cache hit ratio from CDN
☁️ Cloud Services
- Storage: AWS S3, Google Cloud Storage
- Transcoding: AWS MediaConvert, FFmpeg
- Streaming: CloudFront, Akamai, Cloudflare
📌 Final Insight
Designing a video streaming system requires balancing latency, bandwidth, and scalability. Preprocessing via encoding, segmenting for adaptive bitrate streaming, and using CDNs for global delivery are key to a seamless video experience.
