Advertisement
Advertisement

新足迹

 找回密码
 注册
新足迹 门户 IT专业论坛 查看内容

On-demand Video From IIS7 to IOS Devices and Silverlight Client

2010-11-9 11:41| 发布者: dalaohu | 查看: 1729| 原文链接

这个有意思。

http://www.hanselman.com/blog/St ... ed:+ScottHanselman+(Scott+Hanselman+-+ComputerZen.com)

First, I've got this file on my hard drive called ScottGuHDTest1. It's a picture in picture (PIP) test that ScottGu and I did a while ago while looking into new ways to deliver educational video content. Consider this my stock video for this example.

If I want to deliver this content to the web over Silverlight Adaptive Smooth Streaming PLUS I want it to look great on an iPhone or iPad regardless of bandwidth, and I want it all done automatically, I'll need these things.

IIS7 - If you Windows 7 or Windows Server 2008 you already have this.
You may need to check a box under Programs and Features. Easiest way is to install all this stuff with the Web Platform Installer and it'll enable IIS for you.
IIS Media Services 4
IIS Transform Manager 1.0 Alpha
Expression Encoder 4 - You can use the Trial version for VC-1 content, but you'll need the Pro version for H.264. I think it's $199.
For existing videos or videos you're making on a regular basis, the idea is that you'll just drop them in a folder and a task will automatically kick off. You have total control over everything, to be clear, but for the out of the box example, I'm going to drop my ScottGu WMV into a folder and two things will pop out:

A folder with HTML page with a Silverlight media player that supports Smooth Streaming. The ScottGu video will be encoded in various bit rates and be all set for adaptive Smooth Streaming
A folder with MPEG-2 TS format files with .m3u8 manifests that conform to the Apple Live Streaming Protocol.
Here's what you do. Once you've installed the Transform Manager, it'll show up in your IIS Manager as a node. You'll setup account credentials (an account with some power, as it'll need to run stuff and copy files into IIS folders. I used my own. Naughty.)

Now, go to Job Templates and notice there are a bunch of built-in templates. You can create whatever you want to encode video in whatever way makes you happy.

I double-clicked on them and checked all the paths and stuff. You'll need to change the templatePath property to decide on your input and output directories.




I have my input folder here, in c:\inetpub\media\Transform Manager, and there's sub-folders beneath that as seen in this screenshot. Notice that tasks can do multiple things, so mine takes an input file and "fans out" into multiple tasks.


If I drop my ScottGu file in, a task immediately starts up (it's watching the folder) and I can see the progress from the IIS manager. Here it is in the middle of encoding.


The Transforms Manager has lots of interesting parameters that you can set, basically using simple template expansion. It'll make a folder with the Date and Time and a Unique Number, but again, you control all this.

Now I have two folders, one for the Silverlight format...
...and one for the Apple format:



I'll add a HTML page for an iOS device to hit. NOTE: You'll be pointing the iPhone/iPad to this m3u8.ism file and it'll decide what streams to watch:

<html>
    <head>
        <title>iPhone page</title>
    </head>
    <body>
        <h1>Encoded stream</h1>
        <video width="640"
               height="480"
               src="ScottGu720pTest1-m3u8-aapl.ism/manifest(format=m3u8-aapl).m3u8"
               poster="ScottGuSplashPage.png"
               autoplay="true"
               controls="true" >Live</video>
    </body>
</html>

I've also added splashscreen "poster" that's just a PNG frame from the video. Here's a photograph of my iPhone 3G, iPad and iPhone 4 with the video..


...and here it is in Silverlight. Note the chart showing the smooth streaming bandwidth adjusting.

Advertisement
Advertisement


Advertisement
Advertisement
返回顶部