HLS vs DASH

HLS and DASH are the main formats used for delivering adaptive bitrate video. HLS is older and widely supported, however shows no likelihood of becoming an official standard format. DASH is newer, more efficient, and has become a standard. However it is not supported natively within HTML5.

There are other formats available, such as Smooth Streaming (by Microsoft) and HDS (by Adobe). However HLS and DASH are by the far the most dominant and most widely supported, and so we have focused on just those two.

Both HLS and DASH are based on standard HTTP protocols. As they use standard HTTP traffic, firewalls and proxy servers need no additional ports opening. This is a key advantage over UDP-based protocols, which often have to “tunnel” through ports (such as 80, the standard HTTP port) to bypass that restriction.

Since they are based on HTTP, HLS and DASH are ideal for delivery using a content delivery network (CDN), as their segments can be cached at the edge. This makes scaling much simpler than with other protocols like RTMP (use by Adobe’s Flash).

HLS

HLS is short for HTTP Live Streaming. It is a format developed by Apple.

Rather than deliver a video file in one go, HLS splits it into much smaller segments. These are contained within a MPEG-2 transport stream. Each segment is usually 10 seconds in duration and has the extension .ts. H264 has to be used as the video codec.

A separate manifest file then links to those segments. This contains the metadata about the stream and has the extension .m3u8. The manifest is simply a text file, specially formatted in a way that players that support HLS can understand:

A manifest file can link to other manifest files. This allows one of the most useful abilities of HLS (and DASH): adaptive streaming. That is to switch streams, mid-stream, adapting to the available bandwidth. This can be done behind-the-scenes, automatically, without the viewer having to manually switch between qualities. As you would expect, this is particularly useful when your internet connection speed varies as it avoids the video endlessly stopping for “buffering”: it simply drops to a lower quality version when the connection speed is low:

#EXTM3U #EXT-X-STREAM-INF:BANDWIDTH=500000,CODECS=“mp4a.40.2,avc1.4D401F”,RESOLUTION=854x480 500k/stream.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=1000000,CODECS=“mp4a.40.2,avc1.64001F”,RESOLUTION=1280x720 1000k/stream.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=2000000,CODECS=“mp4a.40.2,avc1.640028”,RESOLUTION=1920x1080 2000k/stream.m3u8

Since HLS was developed by Apple, it is the only method of video streaming currently supported on iOS (iPad, iPhone) and is supported natively within its Mac Safari browser too. As of June 2016, on desktop PCs running Windows, only Microsoft’s Edge browser can play HLS natively. Since Apple’s events (such as WWDC) are streamed using HLS, there are no signs Apple is reducing support for it.

HLS supports AES-128 encryption, along with Apple’s own DRM, Fairplay.

DASH

DASH is short for Dynamic Adaptive Streaming over HTTP. Also known as MPEG-DASH, it is an alternative format for streaming video. Again, it splits a larger file into much smaller segments. Usually these segments are shorted than with HLS, with 2 to 4 second durations being common. However unlike HLS, DASH does not require a specific codec. The video could be encoded using H264, however VP9 and H265 are also popular.

Like with HLS, a manifest file (the .mpd, media presentation description, file) contains the metadata for the stream, along with links to the segments. And again, there can be a master manifest that links to ones encoded at different bit-rates. This supports adaptive streaming, whereby the quality of the stream can be adjusted during playback depending on the speed of the connection available.

Unlike HLS, DASH has been adopted as an international standard. Indeed it is the first adaptive bit-rate HTTP format to become one. As such, it is likely to be the most common format going forward.

Another key difference between DASH and HLS is in its support for DRM. DASH is needed to deliver content using Widevine (from Google) and PlayReady (from Microsoft). There isn’t a single, universal DRM solution supported by all browsers and so a combination is needed. For example Google’s Chrome supports Widevine, whereas Microsoft’s Internet Explorer supports PlayReady. However fortunately content can be encrypted just once by using MPEG-CENC (MPEG Common Encryption) in conjunction with Encrypted Media Extensions (EME).

Conclusion

Our player supports both HLS and DASH.

However to avoid encoding your content twice - and doubling the storage required - we currently encode a HLS output by default and then deliver that to all devices. For older browsers (that do not support HLS either natively or via JavaScript extensions) we can fall-back to a MP4 if you request this. We tend not to for security, as the MP4 could be simply downloaded.

HLS is supported on nearly all devices and browsers, either natively or within JavaScript (built into the player) and so it makes sense to pick it as the default for now. We pondered whether to output DASH by default, however we quickly realised that we ended up having to create a HLS version too (because Apple makes up such a large part of the ecosystem). So we were back to the issue of encoding all content twice, which doubles the storage required.

Addendum

A very interesting announcement was made at Apple’s developers conference, WWDC: Apple announced that HLS would support fragmented MP4s. Previously, in order to support the widest number of devices (serving both HLS and DASH) you had to encode two versions of each video. One would be delivered using HLS and consist of .ts fragments, linked within a .m3u8 manifest. The other would be delivered using DASH and consist of .mp4 fragments (or separate audio/video fragments), linked within a .mpd manifest. This doubled the storage cost.

However now, with Apple introducing support for fragmented MP4s within HLS, in theory you should be able to encode content once and then deliver that same file using either HLS or DASH. This is an interesting development as it should help make the two formats compatible. It is currently in beta and we will keep an eye on it. You can read more about how it will work within Apple’s WWDC presentation: What’s new in HTTP live streaming.

If you are interested in using DASH, DRM, HLS, or simply to find out more about our professional online video platform, please email us at [email protected].

Updated: June 30, 2016