AI Hints
Home›System Design Tutorial›Case Study: Video and Crawling
System Design · Lesson 103 of 120

Video Streaming: Upload

From file to formats.

⏱ 2 min read▶ Video at 2:05:09🎓 Free
Watch this lesson in the System Design courseWatch on YouTube ↗Full System Design course

Our next case study is video streaming, like YouTube. A creator uploads one big video file. Millions of viewers watch it on phones, laptops, and TVs, on fast and slow connections. That one file needs a lot of work first.

Video Streaming: Upload
From the video: Video Streaming: Upload
  • One big upload
  • Millions of viewers
  • Many devices and speeds

The upload pipeline

The creator uploads the original file straight to object storage, using a special upload link. A message on a queue starts the processing. Workers split the video into short chunks, and transcode each chunk into several qualities, like two forty p, four eighty p, ten eighty p, and four K. The results go back to object storage, and out to the CDN.

  1. Upload to storage
  2. Queue a job
  3. Split into chunks
  4. Transcode qualities
  5. Push to CDN
The upload pipeline
From the video: The upload pipeline

Why chunks

Splitting into chunks, a few seconds each, helps a lot. Many workers can transcode different chunks in parallel, so a long video is ready much sooner. A failed chunk can be redone on its own. And as we'll see, chunks are exactly what the player needs for smooth playback.

keyvalue
Parallelmany workers at once
Retryone chunk, not the whole video
Fasterready sooner
Playbackplayers load chunks

Summary

Uploads go straight to object storage, then a queue of workers splits and transcodes them into several qualities. Next, playing the video smoothly.

Key takeaways
  • Upload to storage
  • Chunk and transcode
  • Several qualities
Next up: Video Streaming: Playback — adaptive bitrate