Monday, 19 May 2014

Azure Media Services Overview

Previously I’ve mentioned that I’ve worked on the recently released Building an On-Demand Video Service with Microsoft Azure Media Services guide, created by patterns & practices. In this blog post (the first in a series about Azure Media Services, which will focus on the Windows Phone client we created) I’ll provide an overview of the functionality and capabilities provided by Azure Media Services.

Traditionally, building the workflow for the creation, management, and distribution of media is problematic. It involves having to integrate multiple technologies and providers, some of which may be incompatible. In addition, it can require a huge investment in infrastructure, which may not always be fully utilized. These issues can result in a non-standardized workflow that is not easily scaled, and that requires coordination at different stages of the workflow.

Azure Media Services allow you to build scalable, cost effective, end-to-end media distribution solutions that can upload, encode, package, and stream media to Windows, iOS, Android, Adobe Flash, and other devices and platforms. The advantages of Media Services over the traditional approach to building a media workflow include:

  • An API that allows you to easily create, manage, and maintain custom media workflows.
  • A standardised workflow that improves coordination and productivity when there are multiple participants involved in the creation and management of content.
  • Automatic scalability by using global data centers to transcode and deliver media assets, without having to plan for capacity spikes or worry about idle data centers.
  • Cost effectiveness by encoding media once, and then using dynamic packaging to deliver it in multiple formats.

The diagram below shows a high-level overview of the standard workflow used when processing media with Media Services.

overview

The steps involved in the workflow are as follows:

  1. Media is uploaded to Media Services and stored in Azure Blob Storage.
  2. Uploaded media is encoded using the Azure Media Encoder, with the encoded media being stored in Azure Storage.
  3. Encoded media is packaged by the Azure Media Packager, with the result being stored in Azure Storage.
  4. Client applications playback the media located at a URL, with the Origin Service processing the outbound stream from storage to client application.

I’ll now briefly discuss each item in turn.

Uploading media to Azure Media Services

You must upload your content into Azure Media Services in order to be able to encode, manage, and consume it. Media Services uses Azure Storage to store your media for processing and viewing. Your content can be programmatically uploaded using the Media Services REST API or one of the available client SDKs. These APIs allow you to upload one file at a time or perform bulk upload operations. Media Services also allows you to perform secure uploading and storage of your content. Storage encryption will encrypt your content locally prior to uploading it to Azure Storage where it will be stored in an encrypted form.

Supported file types

Various video, audio, and image file types can be uploaded to a Media Services account, with there being no restriction on the types or formats of files that you can upload using the Media Services SDK. However, the Azure Management portal restricts uploads to the formats that are supported by the Azure Media Encoder. These import formats include MPEG-1, MPEG-2, MPEG-4, and Windows Media Video encoded video, MP3, WAVE, and Windows Media Audio encoded audio, and BMP, JPEG, and PNG encoded images. The Azure Media Encoder can export data as Windows Media Video, Windows Media Audio, MP4, and Smooth Streaming File Format.

Processing media with Azure Media Services

In order to process media with Media Services you must obtain a Media Processor instance, prior to encoding, packaging, and protecting media files.

Obtaining a media process instance

Media Services provides a number of media processors that enable video to be processed. Media processors handle a specific processing task, such as encoding, format conversion, encrypting, or decrypting media content. Encoding video is the most common Media Services processing task, and it is performed by the Azure Media Encoder.

Encoding media

Encoding is the process of taking a video and turning it into a format that can be consumed by users. Users could be using a variety of devices to watch your videos, including desktop computers, smart phones, tablets, Xbox consoles, set-top boxes, or Internet-connected TVs. These devices all have features that affect the required encoding. For instance, smart phones have small screens and little storage, while desktop computers have larger screens and larger storage. In addition, smart phones potentially have a more limited bandwidth than desktop computers. Therefore, when you choose how to encode a video you must bear in mind the variety of devices that users will consume the video on.

The Media Encoder is configured using encoder preset strings, with each preset specifying a group of settings required for the encoder. Encoder presets are divided into two groups – general presets and device specific presets. Videos encoded with general presets can be used by any device that supports the required file formats. Videos encoded with device specific presets are designed to be used by a specific device, such as a smart phone.

Packaging media

Once a video has been encoded it is placed in an output asset, which can then be placed into a variety of file containers. This process is referred to as packaging. For example, you could convert an MP4 file into smooth streaming content by using the Azure Media Packager to place the encoded content into a different file container.

Media Services allow the user to decide if they will package video upfront with a media processor, known as static packaging, or package video on demand, known as dynamic packaging.

Protecting media

To protect your media when it is published, Media Services supports PlayReady sample-based Common Encryption and AES 128-bit CBC Envelope Encryption. For more information about content protection see Protecting Assets with Microsoft PlayReady.

Delivering media from Azure Media Services

Media Services provides different mechanisms for delivering media assets that have been uploaded to Media Services. There are typically four approaches that users can use to access videos:

  1. Offline viewing involves a user downloading media onto their device.
  2. Progressive downloading allows a user who is connected to the internet to start viewing a media item before it has been downloaded.
  3. Streaming requires an internet connection but only downloads a small amount of the media item at once and discards it once it has been viewed.
  4. Adaptive bitrate streaming allows client applications to determine network conditions and adapt the data rate of the media content to the available network bandwidth. Media Service supports Smooth Streaming, HTTP Live Streaming (HLS), and MPEG DASH.

Accessing content in Media Services requires a locator, which provides an entry point to access media files. An access policy is used to define the permissions and duration that a client has access to a media asset. There are two types of locators:

  1. Shared access signature locators grant access rights to the underlying blob container of a media asset in Azure Storage.
  2. On-demand origin locators grant access to streaming content through the Origin Service, which pulls the content from Azure Storage and delivers it to the client.

Consuming media from Azure Media Services

Media Services provides support for creating media player applications that run on different devices and platforms including PCs, Macintosh, Windows Phone, iOS devices, and Android devices. Microsoft also provides many different SDKs and player frameworks that allow you to create applications that consume streaming media from Media Services. For more information see Developing Azure Media Services Client Applications.

Summary

Media Services provides everything you'll need to build and operate video-on-demand services to multiple devices and platforms, including all the tools and services you'll need to handle media processing, delivery, and consumption. In addition, Media Services will help your platform scale by using the global footprint of Azure datacenters, without having to plan for capacity spikes or worry about idle datacenters. Together, this helps to reduce the costs that are associated with integrating multiple products and providers when building a media solution. For more information see Building an On-Demand Video Service with Microsoft Azure Media Services.

In my next blog post I’ll examine the application architecture of a video on-demand service created with Media Services.

No comments:

Post a Comment