Sasha Goldshtein's presentation at the Sela Developer Practice (May 2013) on Windows Azure Media Services. Covers basic scenarios, the .NET SDK, and finally an end-to-end flow using WAMS to deliver progressive download and adaptive streaming content.
A Business-Centric Approach to Design System Strategy
Building the Next YouTube with Windows Azure Media Services
1. SELA DEVELOPER PRACTICE
May 5-9, 2013
Lights, Camera, Action:
Windows Azure Media Services
Sasha Goldshtein
CTO, SELA Group
@goldshtn
blog.sashag.net
2. With Windows Azure Media
Services, you can upload, manage,
encode, and stream your media to a
variety of devices on a cloud
scale.
3. Maybe you have a bunch of training
videos you want to share with your
global employee contingent, in the office
and on the go …
4. … or maybe you are hosting the Olympic
Games and need to stream to hundreds
of millions of consumer devices, with
peaks of 100x the standard traffic …
5. … or maybe you’re a TV network, a
cellular carrier, a radio station, an ad
agency, a consumer video website …
and you want to stop worrying about
infrastructure and embrace cloud scale.
8. Supported Devices
• Very wide device coverage for progressive download
• Device coverage for adaptive streaming:
Platform IIS Smooth
Streaming
Apple HTTP Live
Streaming (HLS)
Windows (IE) Silverlight 3rd party SDK
(Flash)
OS X (Safari) Silverlight <video> element
Windows RT Microsoft SDK 3rd party SDK
Android (Browser) 3rd party SDK
(Flash)
<video> element
iOS (Safari) <video> element
Windows Phone Microsoft SDK 3rd party SDK
iOS (in-app) Microsoft SDK MediaPlayer FW
Android (in-app) 3rd party SDK VideoView
9. Pricing Principles
• Available in all sub-regions (NA, Europe, Asia)
• 99.9% availability guarantee with On-Demand
Streaming Reserved Unit
Component Price
Data processing (input and output)
Encoding
Packaging
Up to $1.99 /
GB
Up to $1.49 /
GB
Storage Up to $0.07 /
GB
Outbound bandwidth Up to $0.12 /
GB
Reserved encoding unit $99 / month
Reserved on-demand streaming
unit
Guaranteed 200 Mbps per unit
$199 / month
12. Ingesting Assets from the .NET SDK
Obtain a CloudMediaContext
• Gives you access to all objects and APIs
Create an asset (IAsset)
• A collection of media files
Create a file (IAssetFile)
• A single file within an asset
Create an access policy and locator
• Determines ACL for asset and provides a
URL for upload
13. Encoding Assets from the .NET SDK
Obtain a media processor
(IMediaProcessor)
• Media processors can encode and package assets
Create an encoding job (IJob)
• A job is a set of tasks for Media Services
Add tasks to the job (ITask)
• E.g., encode WMV file for Apple HLS
• Tasks have input assets and output assets
Monitor job progress until it completes
14. Delivering Assets from the .NET SDK
Locate the output asset for a job
Create an access policy and locator
Generate URLs
• For progressive download
• For streaming (IIS/HLS)
Optional: Enable CDN
• For progressive download (blob storage)
• For streaming origin server
16. Playing Progressive Download Assets
• For progressive download in browsers that support
HTML5 video, use the <video> element
<video width="640" height="480" controls>
<source src="@Html.Raw(Model.Mp4SourceUrl)"
type="video/mp4" />
</video>
17. Playing IIS Smooth Streaming
• For PC and Mac delivery of IIS Smooth Streaming,
use the Silverlight Smooth Streaming SDK
• Sample player available on CodePlex
• http://playerframework.codeplex.com/
<object data="data:application/x-silverlight-2,"
type="application/x-silverlight-2"
width="100%" height="100%">
<param name="source"
value="/Content/SmoothStreamingPlayer.xap"/>
<param name="InitParams"
value="mediaurl=@Model.SilverlightStreamingUrl"/>
</object>
Server-hosted
Silverlight
player
Parameters for
player
18. Playing HLS In-App on iOS
• The iOS MediaPlayer framework natively supports
Apple HLS URLs
self.player = [[MPMoviePlayerController alloc]
initWithContentURL:[NSURL URLWithString:...]];
self.player.scalingMode = MPMovieScalingModeAspectFill;
self.player.controlStyle = MPMovieControlStyleDefault;
[self.view addSubview:self.player.view];
[self.player play];
21. On-Premises Windows Azure
Upload App
ASP.NET
Web Site
Worker
Role
Media
Services
Encoder
Media
Services
Streaming
Azure Blob
Storage
Queue
Storage
Azure
Table
Storage
(1) Upload file to Web Site
(2) Store file in Blob Storage
(3) Store metadata in Table Storage
(4) Put encoding command in queue
(5) Start encoding job
(6) Wait for job to complete
(7) Generate streaming URLs
(8) Update metadata in Table Storage
1
2 3
1 2 3 44 5 56 7 8
8 7
23. Summary & Call to Action
• Windows Azure Media Services is a cloud-scale
platform offering for media management,
conversion, and delivery
• .NET management SDK and REST endpoints
• Wide device reach with adaptive streaming and
progressive download
• Try it for free as part of the Azure 90-day trial
Learn more:
www.windowsazure.com/en-
us/home/scenarios/media/
Image taken from http://www.flickr.com/photos/yotut/5432398958/ under Creative Commons 2.0 license.
Image taken from http://www.flickr.com/photos/dskley/7717799328/ under Creative Commons 2.0 license.
Image taken from http://www.flickr.com/photos/scobleizer/4870003098/ under Creative Commons 2.0 license.
Full list of supported import and export formats and codecs: http://msdn.microsoft.com/en-us/library/hh973634.aspx
Remarks:Third-party SDK for HLS on Windows RT and Windows Phone 8: http://3ivx.com/technology/windows/metro/http_live_streaming.htmlThird-party SDK for IIS Smooth Streaming on Android in-app: http://axinom.com/en_axinom_news_android_sdk.AxCMS (there are others)Android supports HLS natively only since 3.0, and there are some issues with this support (browser and in-app): http://www.longtailvideo.com/blog/31646/the-pain-of-live-streaming-on-android/Also see: http://en.wikipedia.org/wiki/HTTP_Live_Streaming#Clients for some more links and details
Example:Encoding a 200MB video to both IIS Smooth Streaming and HLS formats in various bitrates may produce 800 MB of output, for a total of 1GB encoding I/O. Total cost: $1.99.Storing the 800 MB of output would cost approximately $0.06 per month (without geo-replication).Streaming the 200 MB video to 10,000 clients per month (assuming 50% average consumption rate) = 976GB would cost approximately $117 per month.
Illustrate the creation of a new media service.Upload a small mp4 asset. (clipcanvas…mp4)Publish the source (show that the URL is a simple blob storage URL).Use the built-in test player for the source, or simply copy the URL to the browser (this is a progressive download player).Encode the asset for HLS. Explain that there is an intermediate step that encodes to IIS Smooth Streaming and then creates an additional manifest for HLS.Monitor job progress.Publish both the intermediate IIS Smooth Streaming output and the HLS output.Use the built-in test player for IIS Smooth Streaming playback.Use an iPhone/iPad/iOS Simulator for HLS playback.
Show the SimpleUploadEncodeDeliver demo console application:Review the code that creates an asset, gets a storage URL (locator) for uploading the asset, and uploads it.Review the code that configures the encoding job (MP4 ==> IIS Smooth Streaming ==> Apple HLS).Review the code that waits for the encoding job to complete.Review the code that generates the final streaming URLs.(This code was taken from the walkthrough that you see on the dashboard of every new Media Service.)
Show HTML5 page on Mac, Windows, iPad (progressive download with <video> element) – from IBA portalShow Silverlight page on Mac, Windows – from IBA portalShow iOS app with MediaPlayer framework
Demonstrate the IBA pilot “CMS” running end-to-end on Windows Azure.Upload a media file:curl -X POST http://wams-sdp13.azurewebsites.net/Home/Upload?file=test.mp4 --data-binary @test.mp4Wait for encoding to complete.Demonstrate the resulting URLs on Windows / OS X / iOS.Demonstrate the SkyRocketMedia CMS: http://www.skyrocketmedia.netWalk through the different screens, explain that it is a nice wrapper on top of the Azure portal.