40. Design Video Upload and Streaming (YouTube)
1
The interview prompt2
40.1 What do you ask first?3
40.2 How big is this, really?4
40.3 What are the doors?5
40.4 What do we store?6
40.5 What does the whole system look like?7
40.6 How does the upload pipeline work?8
40.7 How does transcoding work?9
40.8 How does adaptive bitrate work?10
40.9 How does CDN delivery work at this scale?11
40.10 How do you count views?12
40.11 What would you say in the last five minutes?13
Score yourself14
Variations to practise15
Sources16
Code lab40. Design Video Upload and Streaming (YouTube)
40.6 How does the upload pipeline work?
3 min read+10 XP
Step 5: Deep dives (10 minutes)
- Direct to storage: the API hands out a signed upload URL (Chapter 11); gigabytes never pass through app servers.
- Resumable: the file goes in chunks (say 8 MB). If the connection drops, the client asks "what do you have?" and sends only the rest. In the chapter's code, a 2 GB upload that drops after 180 chunks resumes with the last 70, not from zero.
- Validate early: check the format and duration before spending transcoding money; reject corrupt or disallowed files.
- Status the creator can see: uploading → processing (with progress) → ready (or failed, with a reason).
Memory code: "Upload in pieces, resume from the gap, check before you spend."