Best Practices for Encoding and Delivering Dolby Audio to Apple Devices
Over the course of this three-part tutorial series, we'll show you how to deliver Dolby Audio via HLS and play it back on any audio endpoint, including device speakers, headphones, or external sound systems via AirPlay or HDMI.
This video tutorial series is sponsored by Dolby.
Dolby Audio is a family of premium sound format(s) that provides enhanced clarity, easy-to-hear dialogue, consistent volume, and also surround sound when played on a 5.1 or 7.1 channel system. Since the release of iOS 10, tvOS 10, and MacOS Sierra, you can now deliver Dolby Audio via HLS and play it back on any audio endpoint, including device speakers, headphones, or external sound systems via AirPlay or HDMI.
Over the course of this three-part tutorial series, we’ll show you how to do just that. In the first tutorial, we’ll provide an overview of the workflow and show examples of the tools you’ll need to get the job done. In the second tutorial, you’ll learn how to measure audio loudness and how to encode files in Dolby Digital Plus, Dolby Digital, and AAC formats to support all devices and audio end points. In the third tutorial, you’ll learn how to segment your streams and create media playlist files with Apple’s Media File Segmenter, and how to create the master playlist file that tells the playback client what audio formats and variants are available, including how to support multiple languages.
Finally, you will learn how to validate your streams with Apple’s Media Stream Validator tool.
There’s a lot of detail in all presentations and they move pretty fast. But you can read up on these materials in this post on the Dolby Developer blog, which also provides full access to the various master playlists you’ll learn to create, as well as the actual HLS video clips they enable, and the presentations you'll see in these videos.
For more information HLS encoding in general, check out Apple's HLS Authoring Specification on the Apple Developer site.
Let's start with a brief discussion of audio formats.
AAC is a widely deployed audio codec in online video, often used as a baseline stereo audio codec. It is supported in HLS for compatibility with systems that don’t support native Dolby playback.
Dolby Digital, also known as AC-3, is an advanced, metadata-rich audio format that can deliver up to six channels of audio at data rates between 384 and 640 Kbps.
Dolby Digital Plus, evolved from Dolby Digital, is a more capable audio format that brings higher audio quality, lower data rates, more powerful metadata-driven features and support for 7.1 audio channels. Also called EC3 or E-AC-3, Dolby Digital Plus produces clear and powerful sound for a remarkably versatile set of outputs, from stereo headphones and speakers to 7.1 surround sound systems.
Both Dolby Digital Plus and Dolby Digital are supported natively across iOS, macOS, and tvOS, as well as Microsoft’s Windows 10 platform. Because of its advanced features, it’s a good idea to make Dolby Digital Plus the preferred audio format on platforms and devices that support it.
If you start from a surround sound audio source, you’ll typically create two encodes in Dolby Digital Plus format; a stereo encode for optimized delivery to stereo devices like iPhones and iPads, and a multichannel encode for systems that support it, like Apple TV. You’ll also want to produce an AAC stereo stream for systems without Dolby support. and optionally, a legacy Dolby Digital 5.1 stream to maintain compatibility with older systems that don’t support Dolby Digital Plus.
You can find system compatibility information for many systems and devices at the Dolby Developer website.
We won’t spend a lot of time on video encoding in this tutorial, but as an overview, our 1080p source video was encoded into eight video-only variant streams, each of which were segmented into multiple MPEG-2 transport stream chunks using Apple’s Media File Segmenter, which also created an M3u8 playlist for each variant.
We’re going to cover three scenarios, all working with the same segmented video streams.
In the first scenario, we’ll assume your video comes only with a stereo audio track in a single language. In this case, you’ll output both Dolby Digital Plus stereo audio that will play wherever supported, and AAC stereo audio for older devices that can’t play Dolby Digital Plus.
You’ll segment both audio tracks just like the video files. Then you’ll create a master playlist that enables the player to select and retrieve the appropriate audio and video streams for synchronized playback.
The second scenario assumes 5.1 input in one language. Here, you will output 5.1 Dolby Digital Plus, and optionally 5.1 Dolby Digital to support legacy devices.
You’ll also output Dolby Digital Plus in stereo for native playback on supported devices, and AAC stereo for devices without Dolby support. Again, you’ll segment the files and create media playlists, plus a master playlist to enable and synchronize playback of these different audio streams.
Our last example will include 5.1 audio, but now in multiple languages: English, Spanish, and Chinese. You’ll output the same four tracks that we covered in the second example, in each language, segment the files, and create media playlists, and create a master playlist file that selects the best audio and videos streams, and the default language, while making the other languages available via menu controls.
During playback, the media player will retrieve video segments from one of these video variant streams, plus audio segments from the appropriate audio track, and synchronize the two to play the complete program. This approach of keeping audio and video separate and dynamically combining the appropriate versions at playback time is sometimes called “late binding.”
Tools Covered in the Tutorials
Let’s quickly cover the tools we’ll be using in these tutorials.
In the second tutorial, we’ll lay out the tracks in Adobe Audition, though you can accomplish the same functions with many other tools. You can measure loudness using the Dolby Professional Loudness Metering Solution and encode the audio using the Adobe Media Encoder.
In the final tutorial, we’ll segment our audio tracks and create media playlists with Apple’s Media File Segmenter, create the master playlist in a text editor, and then validate the streams with Apple’s Media Stream Validator tool.