Visual Studio Live presentation on Windows Azure Media Services. Describes the fundamental set of features and illustrates through the .NET SDK how to upload, encode, and deliver assets to a variety of client devices.
Unleash Your Potential - Namagunga Girls Coding Club
Build the Next YouTube: Windows Azure Media Services
1. Build the Next YouTube:
Windows Azure Media Services
Sasha Goldshtein
CTO, Sela Group
Level: Intermediate
2. Windows Azure
Media Services, you can
With
upload, manage, encode, and
media to a variety
of devices on a cloud
scale.
stream your
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
•
•
Almost all devices for progressive
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
<video> element
iOS (Safari)
Windows Phone
Microsoft SDK
3rd party SDK
iOS (in-app)
Microsoft SDK
MediaPlayer FW
Android (in-app)
3rd party SDK
VideoView
Xbox
Microsoft SDK
9. Pricing Principles
Component
Data processing (input and output)
Encoding
Packaging
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
•
Up to $1.99 / GB
Up to $1.49 / GB
Storage
•
Price
$199 / month
Available in all sub-regions
99.9% availability guarantee with OnDemand Streaming Reserved Unit
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"
Server-hosted
Silverlight player
width="100%" height="100%">
<param name="source"
value="/Content/SmoothStreamingPlayer.xap"/>
<param name="InitParams"
value="mediaurl=@Model.SilverlightStreamingUrl"/>
</object>
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
ASP.NET
Web Site
Upload App
Queue
Storage
1 2 3 4
4
2
1
3 8
Azure Blob
Storage
(1)
(2)
(3)
(4)
Upload file to Web Site
Store file in Blob Storage
Store metadata in Table Storage
Put encoding command in queue
Worker Role
5 6 7 8
5
7
Azure Table
Storage
(5)
(6)
(7)
(8)
Media
Services
Encoder
Media
Services
Streaming
Start encoding job
Wait for job to complete
Generate streaming URLs
Update metadata in Table Storage
23. Summary & Call to Action
•
•
•
•
Windows Azure Media Services is a cloudscale 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
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.