Apple has long been very bullish on efficient media technology, almost singlehandedly popularizing H.264 as a web video encoding while leading the charge on the death of Adobe Flash.
Within our apps, Apple settled on PNG as the image format of choice for its powerful compression capabilities that maintain a high fidelity.
Once again, Apple is bringing to the table some new image and video formats to push the platform foward by saving you storage space, bandwidth and computation time. Here’s the short version:
High Efficiency Video Coding (HEVC) is a codec for both images and videos, which requires almost half the storage space (and bandwidth) of H.264 and JPEG. Apple will reuse the existing
.mov file extension for HEVC video files. HEVC is also called MPEG-H Part 2 and H.265 by industry standards bodies.
High Efficiency Image Format (HEIF) (pronounced “Heef”) is the file format for HEVC-encoded images, and will use the
.heic file extension.
Neither of these formats are bleeding-edge, as both have been ratified by the ISO between 2013 and 2015. This means that many other industry players such as Adobe have already built HEVC/HEIF support into their software.
The vast majority of app developers can carry on as usual. Apple’s media frameworks and apps will transparently use HEVC and HEIF for internal encoding and storage, but will automatically transcode HEIF to JPEG or HEVC to H.264 when exporting media when the user sends an iMessage or the developer obtains a
Relevant frameworks such as AVFoundation, CoreImage and even UIKit have new APIs in iOS 11 to allow you to request the new-format media if you prefer.
mediaExportPreset property defaults to
.compatible, which will cause
imagePickerController(_:didFinishPickingMediaWithInfo:) to vend a JPEG image, but you can change
.current to get a HEIF image instead.
For more on HEVC and HEIF, see WWDC 2017 Session 503: Introducing HEVC and HEIF
First, there is no requirement that you update your server to stream HEVC video. But you absolutely should, because at a sacrifice of 50% additional server storage (which is cheap), you can lop off half your bandwidth usage (which is not cheap) to supported devices.
Should you really bother doing it now? Isn’t HEVC support limited?
Nope! HEVC playback with software decoding will be available on all Macs running macOS High Sierra and all iOS devices running iOS 11. That means iPhones back to the 5S/SE, iPads back to the Air and Mini 2, and the 6th-gen iPod touch.
Some newer models (6th-gen Intel Core-based Macs and A9-based iOS devices) even have hardware decoding support already built-in for even further improved playback and decoding performance.
But I can support even more devices by using H.264 instead!
Do both! You can have both H.264 and HEVC streams in the same Master playlist. You will need to set the
CODECS= attribute on your Media playlists to indicate HEVC support, and then clients will automatically choose the correct stream to meet their requirements.
Given its benefits, it is likely that HEVC will be widely supported across other operating systems (Android, Windows, etc.) in the future. For now, providing both H.264 and HEVC streams is the right choice for optimizing video bandwidth and performance for you iOS user base while not alienating your other target platforms.
Where do I learn more?
HLS content vendors need to:
Interested in learning more about our basic and advanced iOS Courses?
Learn from the experts at a Big Nerd Ranch Bootcamp!
Interested in leveling up your coding skills from the same authors of the Big Nerd Ranch Guide? Subscribe to The Frontier today!
Charles Brian Quinn