Video Processing
What this lesson covers
This lesson looks at the engineering side of onboarding a new movie or series onto Netflix. Because viewers have different internet speeds and devices, each video must be stored in several formats, or codecs, with different levels of lossy compression, and in several resolutions, from phones to TVs. Every format and resolution pair is a separate output, so the work grows as formats times resolutions, and older titles may need re-encoding whenever a better compression technique is developed. Running this on a single machine would be slow and fragile, so the original video is split into chunks, and each combination of chunk, format and resolution becomes an independent task that can run in parallel. The lesson then explains how chunking changed. Fixed three-minute chunks spread the work evenly but could cut through the middle of a scene, causing a lag when the next chunk is requested. Instead, Netflix works with shots of about four seconds and collates them into scenes, so a whole scene can be fetched together. The video also describes how playback behaviour shapes prefetching: for titles that viewers skip around in, only the requested data is sent, while for titles watched continuously, upcoming parts are fetched ahead of time. Finally, the processed video is stored in Amazon S3, which suits static data and is cheaper than a database. The lesson notes add that Netflix provides Open Connect servers to internet service providers to cache movies.
- Each video is encoded into multiple formats and resolutions, giving formats times resolutions outputs.
- Splitting a video into chunks lets each chunk, format and resolution be processed as a separate parallel task.
- Chunking by scenes made of roughly four-second shots avoids lag from cutting a scene at a fixed time boundary.
- Viewing patterns decide whether to send only requested data or to prefetch upcoming parts.
- Processed video chunks are stored in Amazon S3, a cheap store for static data.