HLS (HTTP Live Streaming) is an emerging standard in adaptive bitrate video. Adaptive bitrate video delivery is a combination of server and client software that detects a client’s bandwidth capacity and adjusts the quality of the video stream between multiple bitrates and/or resolutions. The adaptive bitrate video experience is superior to delivering a static video file at a single bitrate, because the video stream can be switched midstream to be as good or bad as the client’s available network speed (as opposed to the buffering or interruption in playback that can happen when client’s network speed can’t support the quality of video).
With HLS emerging as a standard, and major players like Apple’s iOS & Google’s Android OS leading the way, Encoding.com wanted to provide developers with a complete guide to the standard’s evolution, architecture and device compatibility. We are all increasingly familiar with the issues surrounding video delivery to multiple devices, and HLS has rapidly become the standard for adaptive bitrate technology for mobile/tablets, OTT, and desktop. With this resource, we wanted to bring to light the ever-present confusion within the industry regarding the origin of HLS, its technical specifications, device support, and many other variables.
TRY HLS ENCODING FOR FREE
HTTP Live Streaming History
Apple adopted the HLS standard in 2009 to solve the problem of delivering video to mobile devices over varying bandwidths. They developed a system using adaptive streaming which enables delivery of audio and video to supported devices from a standard http web server as opposed to a specialized streaming server.
Top Use Case Scenarios for HLS
If you are working on or looking to do any of the above, you should become acquainted with Apple’s HTTP Live Streaming. We’ve got all the information you’ll need to help you get started.
What is HTTP Live Streaming?
Apple’s HTTP Live Streaming (HLS) is a method for streaming audio and video over HTTP from an ordinary HTTP based web server. While HLS was initially developed for playback on iOS-based devices 3.0 and higher—including iPhone, iPad, iPod touch, and Apple TV—and on desktop computers (Safari on OS X), it’s use has expanded to OTT devices as well as other mobile and tablet devices.
HTTP Live Streaming supports both live broadcasts and prerecorded content (video on demand) and multiple alternate streams at different bit rates and resolutions. HLS allows for the client to dynamically switch between streams depending on bandwidth availability. HLS also provides for media encryption and user authentication over HTTPS, allowing publishers to protect their work. HLS is a step up from progressive downloading which just enables the playback of a video prior to completing the full download.TRY HLS ENCODING FOR FREE
The HLS Output File Structure and Codec
HLS is a truly adaptive bitrate technology. When video is encoded to HLS multiple files are created for different bandwidths and different resolutions. The files are encoded using the mpg2_ts codec. The streams are mapped to the client in real time using an .M3u8 index file based on screen size and available bandwidth. For more HLS details click here.
Device and OS Compatibility
Mobile/Tablets HLS Support
All iOS devices running 3.0 and later support HLS.. There are many other devices that also support HLS. *See below.
|iPhone 1 – 3GS||iPhone 4, iPad 1||iPhone 4S+, iPad 2-4,||iPhone 5, 5S+|
|Profile||Baseline Profile||Main Profile||High Profile||High Profile|
|Level||Level 3.0||Level 3.1||Level 4.1||Level 4.2|
|Audio||AAC audio, 1-2 channels||AAC audio, 1-2 channels||AAC-LC audio, 1-2 channels||AAC-LC audio, 1-2 channels|
|Max Framerate||30 fps||30 fps||30 fps*||60 fps|
|Video Bitrate||Up to 1.5 Mbps||Up to 5 Mbps||Up to 5 Mbps||Up to 5 Mbps|
|Audio Bitrate||Up to 160 kbps||Up to 160 kbps||Up to 160 kbps||Up to 160 kbps|
|Audio Sample Rate||30 fps||30 fps||30 fps*||60 fps|
|Max Framerate||48000 or less||48000 or less||48000 or less||48000 or less|
iPad 1: 1024×768
iPad 2: 1024×768
iPad 3/4: 2048×1536
HLS has limited support on devices running the Android operating system. Device support is not the same from one version or one device to the next. Android devices before 4.x (Gingerbread or Honeycomb), do not support HLS. Android tried to support HLS with Android 3.0, but excessive buffering often caused streams to crash. Devices running Android 4.x and above support HLS, but there are still inconsistencies and problems.
*Most new top-of-the-line Androids now support High Profile level 4.2, 60fps
See the attached article for reference from www.longtailvideo.com.
Desktop HLS Support
For desktop, Safari 6.0 and higher supports HLS on all devices. No other web browser has native support for HLS. Adobe also recently added full support for HLS its flash player to ensure customers have a more efficient way to distribute video to more devices, using one video format. Click here for more information. JW Player is a great option for delivering HLS content to the desktop. By embedding HLS support in their flash player, JW player can stream to any web browser that supports flash, thus overcoming Safari being the only browser to support HLS. To learn more about JW Player and HLS, check out this document. The latest version of the VLC desktop player also supports HLS.
OTT- Over-the-top Video Devices
Most current OTT devices support HLS. Like HLS, OTT devices prefer transmitting data over HTTP, which makes the two technologies a great fit as HLS is also delivered via HTTP. Some of the top OTT devices with support for HLS are as follows:
HLS Closed Captioning
Encoding.com is the first and only encoding service to offer universal closed captioning support for delivery to all devices. The Encoding.com API makes it really simple to extract, inject, mux or copy closed captions of any kind for distribution to most mobile digital video platforms. HLS supports the CEA608 standard for closed captioning, as well as the new HTML5 WebVTT standard for text video.
HLS Encryption with Encoding.com
HLS content can be easily encrypted. Currently HLS supports AES-128 encryption using 16-octet keys. There are three ways in which encryption can be applied: using an existing key, using a randomly generated key, or using a new key that’s generated for every X number of video segments. The more video segments that have unique encyrption, the greater the overhead and the less the performance. Keys can be served over SSL for an added layer of encryption.
Encoding.com HLS Support
Encoding.com offers several methods for ingesting your content. Programmatically using the API, using a watch folder, using the web interface, or via a desktop uploader (OSX or PC).
The web interface is a great place to start testing the power of the encoding.com platform. All the settings required for optimized HLS content are at your fingertips in an easy to use interface.
Our new Desktop Uploader makes it easy for anyone to batch upload large source files and process them in parallel at a massive scale. Simply drag source files into the Encoding.com icon in your toolbar and your done! Customers with a Max plan or greater can even take advantage of our blazing fast Aspera servers.
The best way to automate your encoding workflow is through the Encoding.com API. We have XML templates for all popular devices, configured with optimal settings for each device. Below is the the generic HLS template, allowing complete control over your encoding parameters.
For more information on technical specifications click here.
There are several options for creating online watch folders. S/FTP, Amazon S3, Rackspace Files, Aspera, Microsoft Azure, and Dropbox can all be configured as watch folder locations. You can set the check frequency of your watch folder anywhere from 5 minutes to 1 day. When content is detected in your watch folder it is ingested by Encoding.com and ready for processing. Users can set the region for their watch folder so files are sent to the nearest entry point to Encoding.com.
HLS for iOS
Encoding.com makes encoding video to HLS for iPhone and iPad Streaming easy with our templates configured for every popular iOS device.TRY HLS ENCODING FOR FREE
Encryption of HLS with Encoding.com
Securing your iPhone streams is seamless with Encoding.com’s stream encryption option. We encrypt your TS segments using AES-128 with no need for an additional processing step. The encryption passes on delivery, as opposed to requiring additional processing time. Click here for a list of steps to get started.
New version of our HLS Segmenter
Encoding.com has recently released a new version, V3, of our HLS segmenter. The new version has lower overhead and increased reliability. The new version has been launched along with our existing V2 segmenter to avoid any disruptions to production HLS workflows. Please compare this HLS output and let us know what you think. Simply add <segmenter>v3</segmenter> to the “HLS” section of your API request.
Encoding.com HLS Pro
Encoding.com has introduced a new service which now allows you to create multiple h.264 levels for each output. Baseline, Main, and High can all be mapped based on device parameters. In addition, you can now create audio only HLS streams. We’ve added this to provide broader and more granular device support. Using Dolby’s HE-AAC codec provides much better audio quality at lower bitrates as compared to the open source libfacc codec. This is important since Apple requires a still image with audio fallback for very low bandwidth scenarios. Since different devices support different h.264 profiles and levels, these are now mapped on a device-by-device basis. In addition, Vid.ly now supports these more granular device parameters, providing more efficient device support. Previously all iOS devices were served a similar h.264 profile and level, and now that will be mapped specifically for each device. We also support the creation of multiple audio streams so the best stream can be delivered on a device by device basis. In addition to audio we also support the latest closed caption standard, WebVTT, ensuring broad accessibility support.
We also now give customers far more granular support over h.264 parameters within HLS. Previously, advanced h.264 parameters within HLS were set to standard defaults. Below are all the advanced h.264 parameters, their definition, and an overview of recommended parameters. This provides broader compatibility for not only iOS devices, but also popular Android devices.
<coder>0,1</coder>– This parameter should be enabled when encoding high motion video or animation as it improved compression by about 15%. It needs to be enabled when the <trellis> parameter is enabled.
0 – disabled
1 – enabled
<trellis>0,1,2</trellis>– This parameter determines rate-distortion, this parameter will generally increase quality and should be enabled.
0 – disabled
1 – enabled only on the final encode of MB
2 – enabled for all mode decisions
<bf>0-16</bf>– bi-directional interpolated prediction frames are a critical component of the h.264 standard, and only supported when using the main and high profiles. Generally this is set to the maximum of 16.
<subq>1-9</subq>– This parameter determines which algorithm is used for subpixel motion searching and partition decision.
1: High speed, low quality. Only use on first pass encoding.
2-5: A little better, and a little slow processing, 5 serves is good for faster encoding.
6-7: 6 is the most commonly used parameter. Enables rate-distortion optimization for partition decision. Significantly increases efficiency, but there is a measurable speed cost.
8-9: Enables rate-distortion refinement, which refines both motion vectors and intra prediction modes. Slower than 6, but again, more efficient and higher quality.
<refs>0-16</refs>– An important h.264 feature that allows for reference frames other than the one before or after the current frame. Using this parameter you can specify up to 16 reference frames. For live action 4-6 reference frames will suffice, but for animation 16 should be used. Generally the default is 6.
<level>10,11,13,30,31,32,40,41,42,50,51</level>– is a specified set of limits that specifies the level of decoder performance. Maximum picture resolution, frame rate, and bit rate that a decoder may use are all specified by the level parameter. WikiPedia has in-depth specs for each parameter.
<profile>baseline, main, high</profile>
– This is what the h.264 profile to be used for encoding. There are 21 profiles in total, grouped into baseline, main, and high.
Baseline provides support for intra and inter-coding and entropy encoding with context adaptive variable length codes. (CAVLC) Common use cases for the ‘baseline’ profile are VoIP applications. The original iPhone through the 3GS support baseline level 3.0.
Main provides support interlaced video, intercoding using b-slices inter coding using weighted prediction and entropy encoding for context based arithmetic coding (CABC). Common use cases include archival storage of broadcast quality outputs. CABAC entropy coding, b-slices, and interlaced coding are all features unavailable in baseline but available in high. iPhone 4, iPad 1, AppleTV 1 & 2, iPod touch 4 & 5, and newer Android devices support main level 3.1.
High has advanced support for things like quantization scaling matrices and 8×8 transform adaptivity. As you can imagine, the high profile is the profile of choice when encoding HD or broadcast quality content, and is what is used for both Blu-Ray and HDTV services. iPhone 4S+, iPad 2-4, AppleTV 3, newer Android devices support high level 4.1, and some high level 4.2.
It’s not just our features that make HLS Pro better. We also provide the ability to package and delivery your HLS content as compressed .zip or .tar files for more efficient delivery. In addition, with up to 16 processing cores, encoding times are drastically reduced. We’ve ensured absolute compliance with Apple’s Media Validator through rigorous testing.
For our API XML:
<?xml version="1.0"?> <format> <output>advanced_hls</output> <stream> <!-- Video settings params --> <profile>[high|main|baseline]</profile> <!-- Audio settings params --> <!-- Other format params --> <!-- Closed Captions params --> <!-- Editing features params --> <audio_only>[yes|no]</audio_only> <still_image>[no|each_segment|first_segment]</still_image> <still_image_time>[Time]</still_image_time> <still_image_size>[Size]</still_image_size> </stream> <!-- multiple stream params may be included in advanced_hls output format --> <stream> <!-- stream params --> </stream> <!-- Format fields --> <segment_duration>[Duration]</segment_duration> <pack_files>[yes|no]</pack_files> <pack_type>[tar|zip]</pack_type> <pack_each_stream>[yes|no]</pack_each_stream> <encryption>[yes|no]</encryption> <encryption_key>[128bit-key]</encryption_key> <encryption_key_file>[SourceURL]</encryption_key_file> <copy_nielsen_metadata>[yes|no]</copy_nielsen_metadata> <segmenter>[v1|v2|v3]</segmenter> <destination>[DestFile]</destination> </format>
HTTP Live Streaming Tips
By default, Encoding.com uses Apple’s recommended parameters as presets for segment size and frame rate, which are 9-second segments at 30fps. Additionally every HLS stream should include a static fallback image for very low bandwidth situations. Audio is always encoded with a 64k stream for all bandwidths and resolutions. By default Encoding.com uses Dolby HE-AAC because it produces the highest quality audio at the lowest bit rates.
Here are some additional tips when creating HLS content with Encoding.com:
*Pay particular attention to our Tar or not to Tar options below:
Encoding.com Success Stories
Our clients have had tremendous success encoding content to HLS. Here are just a few examples we’ll share…
The Customer: Music Choice
Music Choice is one of the world’s largest music video broadcasters with millions of hours of content served to a global audience.
Music Choice has a massive library of music video content that they needed to serve across hundreds of devices and varying bandwidths. They also wanted to ensure their encoding efforts would not become instantly obsolete and content could still be served to an always evolving list of devices and players.
The Encoding.com Solution
Music Choice leveraged the extensive processing power of the Encoding.com platform to chew through their content library. They automated their encoding through the use of the Encoding.com API. In order to ensure device support they used a version of HLS with not only multiple bitrates, but with corresponding resolutions for mobile, tablet, OTT and desktop. By using the JW Player with native HLS support they were able to serve content to the desktop beyond Safari. Because audio quality is a critical component of their brand and service, they used Dolby HE-AAC audio encoding, which realizes the best quality audio at lower bitrates.
Music Choice’s first pass with Encoding.com converted over 11,000 music videos to HLS. A process that would have taken months and hundreds of servers took just a few weeks on the Encoding.com platform.
The Customer: Hurley
Hurley is a cutting-edge and trend setting clothing and accessories designer. Hurley is a lifestyle company influenced by surfing, fashion, skating, snow sports, music and art.
Hurley recently launched their new iPhone application, U.S. Open of Surfing, including tons of longer and higher MB videos. With Apple’s new requirements for in-app videos, HLS was required which can be a complex task for any company.
The Encoding.com Solution
Encoding.com made the complex process of converting video to HTTP Live Streaming incredibly simple. Apple requires that videos be segmented into 10 second chunks with each segment encoded into four different bit rates. And, the lowest bit rate rendition must be audio only with still images. Hurley is able to leverage the Encoding.com iPhone Streaming preset to pull videos from their Rackspace cloud storage, encode into the Apple recommended multiple bit rates, and deliver the full package (encoded segments and .m3u8 stream instruction file) directly to their CDN for streaming.
More HLS Resources
For a great resource on HLS click here.