sábado, 10 de dezembro de 2011

Jeroen Wijering is the creator of the incredibly successful JW Player, which has generated millions of downloads since its release in 2005. In 2007 he co-founded LongTail Video, focusing on a full-fledged online video platform that includes encoding, delivery, syndication and advertising.

The mobile video space has begun to consolidate. In early November, Adobe announced it would stop developing its Flash Player for mobile devices (read: Android). Going forward, HTML5 will be the only method to play back video on mobile phones and tablets.

This is a big win for Apple, the company to most strongly oppose Flash over the last few years. The company is indeed beginning to dictate the industry’s future. In addition to defeating Flash in the battle for video playback, Apple continues to innovate with its H.264 codec, since WebM is still nowhere to be found.

The company has also taken the lead in video streaming. Apple’s homegrown streaming protocol, HTTP Live Streaming (HLS), has always been the one and only way to stream content to iDevices. Now, due to the popularity of iOS, many tool vendors and even competing platforms are starting to support it too.

Playback and Encoding

According to Adobe, Android 4 (Ice Cream Sandwich) will be the last mobile platform to use a Flash plugin. The OS is launching without one, though. Given Flash’s terrible track record with mobile, it wouldn’t be surprising if it never arrives. Therefore, video publishers should ensure their Android video works in HTML5.

In terms of encoding, the H.264 codec is baked into the CPU of every single mobile phone today, while WebM is still confined to a software-only (and non-HTML5) implementation on some Android devices. Google is working on hardware, but the path from reference designs to phone integration, and eventually market share, is a long one.

Until WebM hardware decoding is supported by a decent slice of mobile devices, video publishers will continue to focus on H.264. Seeing this, Google continues to support H264 in Chrome, despite announcing that it would drop it almost a year ago. For all intents and purposes, H.264 is the baseline codec for HTML5 video at present.

What Is HLS?

The acronym HLS stands for HTTP Live Streaming. It is a protocol that allows publishers to stream video using plain HTTP web servers, as opposed to using expensive and hard to scale dedicated streaming servers. This streaming is achieved by chopping up the video hosted on the server into small fragments (usually 10 seconds), and then stitching them together again in the browser. The browser only requests the next fragment in line, instead of loading the entire video and wasting bandwidth, which is how vanilla HTML5 operates. See the diagram below for a single fragmented stream.

A video streamed through HLS is usually encoded into multiple qualities, ranging from a mere 180px to full-blown 720px and beyond. Every time the browser returns to the server to load the next fragment, it decides which quality level to load. Thus, the browser continuously adjusts the quality of the stream to best match the available bandwidth. This is hugely important in mobile, because devices perpetually swap between 2G, 3G, 4G and Wi-Fi connections. See diagram below for an adaptive fragmented stream.

In addition, the fragments of HLS streams can be encrypted for secure delivery. Users who intercept these fragments will not be able to play them at all. This is a big security advantage over plain HTML5 video, in which every savvy user can find the URL of a video and download for his own use.

Why Use HLS?

Today’s wide usage of the HLS protocol is a result of iOS success. Apple designated the protocol as the one and only way to stream video to the iPhone and iPad. No Flash, no Silverlight, no RTP or RTSP. On top of that, HLS is required for in-app video. Even simple MP4 downloads, which work for in-browser playback, are not allowed in iOS apps.

Are there are any competing protocols? Absolutely. Dynamic Streaming from Adobe is one, but requires the (now desktop only) Flash plugin. Also, Smooth Streaming from Microsoft requires Silverlight, another desktop-only (and soon to retire?) plugin. HLS is deployed on top of HTML5, which is easily implemented by both browsers and devices.

A standardization effort is on its way as well, in the form of MPEG DASH (Dynamic Adaptive Streaming over HTTP). Supported by many companies (including Apple) and boasting a rich set of features, DASH may well become the single video streaming protocol to replace HLS, as well as RTMP and RTSP. However, progress is slow and broad support is years away.

The Apple Standard

For the foreseeable future, we’ll watch our mobile video the Apple way: HTML5 embedded, H.264 encoded and HLS streamed. Any platform seeking broad support for quality video (Windows Phone?) must implement HLS. And any publisher seeking mobile viewers must encode in H.264, embed using HTML5 and stream using HLS.

Is this a bad thing? Quite the contrary. The alternative is fragmentation: multiple plugins, multiple codecs and multiple protocols. This is an annoyance for large media corporations; it increases their development and delivery costs. However, it’s disastrous for smaller video publishers, since the companies lack the resources to build and support multi-platform video delivery. Ultimately, that is a detriment to mobile video. Like the web in general, mobile video thrives on broad availability of a wide variety of content.

A more open set of standards (WebM and DASH) should come in time. For now though, Apple is the standard.