When Netflix introduced the ability to download content onto mobile devices for offline viewing earlier this week, it also debuted a few technical tweaks to make sure that those downloaded episodes of “Black Mirror” won’t eat up all of your phone’s storage. Eventually, Netflix wants to use the same technologies to optimize streaming to mobile devices as well.

One of the biggest differences between shows you download and shows you stream on Netflix is the video format, or codec, the company is using. For streaming, Netflix has been using H.264/AVC almost exclusively. However, users who download Netflix shows to most Android devices instead receive content encoded with VP9 — an open source video codec developed by Google that uses a bunch of advanced encoding tricks to deliver the same video quality with significantly less data, or a better video qualities with the same amount of data.

The problem with VP9 is that it isn’t supported by everyone in the industry. Given Google’s backing, it obviously runs on Android and in the company’s Chrome browser, and a growing number of consumer electronics devices are capable of playing VP9 videos as well. iPhones, however, can’t and Apple has given no indication that it plans to support VP9 any time soon.

That’s why Netflix is also encoding its downloadable videos with a different flavor of H.264/AVC, which is also known as a different profile. (For the technically inclined: Netflix’s streams are encoded with H.264/AVC Main, whereas its downloads come in H.264/AVC High. The company shared more details on its tech blog this week.) This isn’t quite as effective as using VP9, but still allows Netflix to shave off some bits.

But Netflix didn’t just switch its codecs. The company’s encoding team also realized that different scenes in different movies require vastly different amounts of data. An action scene with a lot of visual noise contains a lot more visual information than a scenic shot of a blue sky, and animated movies in general are much easier to encode than live-action films.

Netflix first started to account for these visual differences last year, when it began to tweak its encoding settings for each and every title — an approach that helped the company to deliver better-looking streams to users with slower internet connections while saving up to 20% of data.

For its new download option, the company is taking the idea one step further: Instead of changing these settings per title, Netflix is cutting each and every video into one-to-three-minute-long chunks. Computers then analyze the visual complexity of each and every of these clips, and encode with settings that are optimized for its visual complexity.

The resulting potential bandwidth savings are significant: Compared to the encoding tech Netflix uses for streaming, using this chunking method in combination with the new VP9 codec saves around 36% of bandwidth on average for videos that look the same to the human eye.

Videos encoded with H.264/AVC High still use up to 19% less bandwidth on average. In other words: iPhone users could theoretically be able to save five episodes of “Black Mirror” with the same amount of space on their phone that would have been occupied by four episodes with Netflix’s existing technology.

To be fair, the actual storage savings may not be as significant in every case. That’s because optimizing encoding of videos isn’t just about saving space on your phone, or making sure you don’t go above your monthly data cap. The same tech is also being used by Netflix to optimize the quality of videos prepared for download, meaning that Netflix delivers better-looking videos without eating up more of your phone’s storage.

The potential to improve video quality is also a big reason why Netflix plans to bring both chunk-based encoding as well as new encoders to mobile streaming in the coming months as well.

Correction: 12/4: An original version of this article primarily focused on storage savings of the new encoding approach. It was updated to reflect the fact that Netflix also uses the technology to improve video quality.