Google TV

How to Implement HLS for Google TV

Les Vogel - Google TV Developer Relations

Http Live Streaming aka HLS is a standard for streaming multimedia content (Audio and Video) supported by Google TV.

There are many cool features that come with HLS. The main ones are:

  1. Adaptive Streaming - Automatically adapts to either congestion or bandwidth availability.
  2. Resilience to transient network failures.
  3. No special configuration for your server, routers, or firewalls. It's just HTTP 1.1.
  4. Easily supported by Content Delivery Networks.
  5. Live streaming is supported (more in a longer article).
  6. HTML5 video tag support in Chrome for Google TV.
  7. Optional AES encryption (more in a longer article).

On Google TV, HLS is a standard protocol, you just put your url in any of the Media Playback APIs such as MediaPlayer, VideoView, etc. It just works.

Components of a HLS file

.m3u8 - Text based manifest or playlist file (may be updated for live content) - a variant playlist usually points to individual manifests that also end in .m3u8
MIME Type: vnd.apple.mpegURL or application/x-mpegURL

.ts - MPEG 2 Transport Stream - Typically 5-10 seconds long video & audio data.
MIME Type: video/MP2T

Creating content for HLS

The easiest way to create HLS content is to use Apple's tools, the latest version of Sorenson Squeeze, Telestream's Episode, and many cloud encoding providers. You start with content you encode at many bit rates. For Google TV, the first line in the .m3u8 file is the speed we start with. It's probably best to pick the 1.2mbps stream.

Google TV supports HLS protocol version 3 as of Google TV firmware version 3.2.

Your content URL's must have the characters .m3u8 within the URL. If the URL doesn't end with .m3u8, the system will make at least 2 requests before playback and the MIME type of the playlist must be one of application/vnd.apple.mpegurl or application/x-mpegurl.

Encoding

Encoding content is as much an art as it is a science. The best choices are very much dependent on your content, what speed objects move against the background, and many other items that are too numerous to go into a simple post. It is also dependent on the devices you are targeting. The settings below are designed to be optimized for Google TV. Older devices may require different / additional encodings. Be aware that certain types of encoding for commercial purposes may require a license and/or the payment of royalties.

Audio Encoding should be consistent across all streams. HE-AACv1, HE-AACv2, AAC-LC up to 48kHz, stereo audio are all acceptable choices.

16:9 Aspect Ratio

DimensionsTotal BitrateVideo BitrateEncoding
640x360640600HiP, 4.1
640x36012401200HiP, 4.1
960x54018401800HiP, 4.1
1280x72025402500HiP, 4.1
1280x72045404500HiP, 4.1
1920x108060406000HiP, 4.1
1920x108081968156HiP, 4.1

4:3 Aspect Ratio

DimensionsTotal BitrateVideo BitrateEncoding
640x480640600HiP, 4.1
640x48012401200HiP, 4.1
960x72018401800HiP, 4.1
1280x96025402500HiP, 4.1
1280x96045404500HiP, 4.1

Seeking Behavior

The Google TV seeking behavior is simplistic, in that it will only seek to the start of a fragment (HLS is typically made up of 10 second fragments). It will not seek within a fragment, even if there are Key frames inside the fragment.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.