Installing and Setting Up and Encoding for IIS 7 Smooth Streaming and Silverlight
I heard someone saying they were having trouble setting up Smooth Streaming for IIS, so I wanted to try it myself.
If you just want to see Smooth Streaming work, visit http://www.smoothhd.com/ for some sample demos. They'll adapt to your bandwidth and look as nice as they can. If you want to fake a low-bandwidth situation, you can use the player at http://www.iis.net/media/experiencesmoothstreaming and play with limiting the bit rate.
Step 0: Got IIS?
I've got IIS 7 because I've got Win 7. If your Win 7 installation doesn't have IIS yet, go to Programs and Features and click "Turn Windows Features On or Off" and select Internet Information Services. Don't forgot to go through the tree and turn on the things you want, like "Static Content" in this case. (Remember, if you've just installed IIS, shut down Skype as it grabs port 80 if it gets there first. Lame.)
Step 1: Add IIS Media Services
I'm running Windows 7 x64 so I installed IIS Media Services 3.0 64-bit, but you can certainly install IIS Media Services for 32-bit also. Even easier, just install it from the Web Platform Installer directly.
Installing the IIS Media Services pack gives you a new icons in the IIS manager:
Step 2: Get (or Make) Some Content (and Encode It)
If you just want to see this work, you can get some pre-encoded content, below in 2a. Later in 2b, I'll encode some new content.
Step 2a: Get Some Pre-Encoded Content to Test
Use At this point, if you're just testing, you can go download the pre-encoded "Buck The Bunny" HD Video Sample Content (about 500 megs of HD video). Run it, extract the files, and put them somewhere like c:\inetpub\wwwroot\bunny.
HOW SMOOTH STREAMING WORKS - SIDE NOTE: You kind have to see it to get it, but it's actually clever in its simplicity. Some folks freak out when they take a, say, 200 meg video file and encode it for Smooth Streaming and the resulting directory is, say, 500 megs. They might say, it's larger! I don't have that kind of bandwidth! In fact, less is sent over the wire than exists on disk. The idea is that Smooth Streaming creates "steps" of bitrates. It encodes and stores your file multiple bit-rates on the disk.
To illustrate this, I will use the DJ Hero video game as an example:
Just as the DJ moves between tracks depending on how the crowd feels, Silverlight between encoded streams depending on the bandwidth is doing. Remember, it's called "Adaptive" Smooth Streaming.
Now I visit http://localhost/bunny/default.html and rather than the standard Silverlight Player, I'm going to select one called "User Experience Simulator." Basically, I want to fake a low bandwidth situation and see the Smooth Streaming react.
NOTE: If you like, or you're demoing this to a boss or someone, there's a prettier/shinier player on the Smooth Streaming Sample Content page that you can swap out. Details on the Getting Started Page for Smooth Streaming.
I start the player, and you'll notice on teh right side there's "Now Downloading" and "Max Bit Rate." I'll force a lower bit-rate (again, I'm simulating congestion here) and seek within the video. Then raise it, and wait, or seak. Notice the chart showing that the Silverlight Player "switched tracks" without dropping frames.
Another metaphor would be changing gears on a bicycle to adapt to a changing road.
Step 2b: Encode Some Content of Your Own.
Ok, so that was just existing content. You can download Expression Encoder 3.0 and encode all the video you want, but if you want to encode Smooth Streaming or H.264, you have to upgrade for $49 to Expression Encoder 3.0 with IIS Smooth Streaming. (By the way, Expression Encoder will also do Screen Capture, which is nice to know. The free version will do up to 10 min of Screen Capture, which is also useful to know.)
I drag a video of ScottGu in HD into the Encoder and select IIS Smooth Streaming. Since my source is HD 720p, I'll select that. By default, the profile will basically encode a high version and low version, but for best results you'll want to decide how many levels of stepping you want. Expression Encoder can be run in a batch from the command-line also, BTW.
Make sure you click the encoding option you want, right-click and say "Apply to Selected Items." You'll know you got it right if the Video section further down (that you can open up) includes multiple streams of various sizes and bitrates. Notice the screenshot. More streams will mean longer encodes and more space on disk taken up, BUT it'll make for more bitrate options for the player to choose and a MUCH better, smoother experience. Again, you might have 1, 5 or 10 streams for a 1 gig source and end up using 5+gigs of space on disk (I made those numbers up) but the end user's experience will be smooth and the bandwidth used will be as small as possible.
It is worth noticing that screencasts should mostly be encoded using an H.264 Screen Encoding profile, while action like sports games work better with other codecs. What looks good on the football field often looks like crap if it's some dude coding on his screen. You'll also want to have a reasonable minimum resolution and a minimum bitrate. Experiment and you'll find what works and save it as a custom profile that's right for your content.
After I encoded all this, I thought to myself, crap, the REALLY LOW bandwidth version is not acceptable. Do I have to re-encode to not include that one? I can just hack the .ism file manifest as it's just XML and remove all knowledge of that lower bit-rate file. UPDATE: There's a nice UI to managed rethe different bit rates, so no need to hack any XML.
It can be tricky to do the math and figure out what resolutions and bitrates to use for your smooth streaming content so you can use this Silverlight-based Smooth Streaming Multi-Bitrate Calculator. There's a WPF one also. To get really good quality you'll vary not only the bitrate, but also the resolution (but you'll stretch it, so the user won't know the resolution changed also.) Ultimately you have complete control as everyone's content has different needs.
The "More Info Than You Asked For" Section: What's Really Happening?
If you want a deep deep dive into what's going on, check out the Smooth Streaming section of Alex Zambelli's blog. It's wonderfully deep. A lot of people don't realize that Smooth Streaming is still just plain HTTP.
Traditionally streaming is a long running stream over a stateful protocol, where a packet is a some milliseconds of video.
Adaptive Streaming is chunked over HTTP where the client can choose different chunk sizes in various bit rates.
From Alex's blog:
A typical Smooth Streaming media asset therefore consists of the following files:
- MP4 files containing video/audio
- *.ismv – contains video and audio, or only video
- 1 ISMV file per encoded video bitrate
- *.isma - contains only audio
- In videos with audio, the audio track can be muxed into an ISMV file instead of a separate ISMA file
- Server manifest file
- *.ism
- Describes the relationships between media tracks, bitrates and files on disk
- Only used by the IIS Smooth Streaming server – not by client
- Client manifest file
- *.ismc
- Describes to the client the available streams, codecs used, bitrates encoded, video resolutions, markers, captions, etc.
- It’s the first file delivered to the client
Both manifest file formats are based on XML. The server manifest file format is based specifically on the SMIL 2.0 XML format specification.
With IIS7 Smooth Streaming, a client is expected to request fragments in the form of RESTful URLs:
http://video.foo.com/NBA.ism/QualityLevels(400000)/Fragments(video=610275114) http://video.foo.com/NBA.ism/QualityLevels(64000)/Fragments(audio=631931065)The values passed in the URL represent encoded bitrate (i.e. 400000) and the fragment start offset (i.e. 610275114) expressed in an agreed-upon time unit (usually 100 ns). These values are known from the client manifest.
But most importantly, therefore I make it bold and in red so you'll read it twice:
...what about dynamic bitrate switching that makes adaptive streaming so effective? This part of the Smooth Streaming experience is implemented entirely in client-side Silverlight application code – the server plays no part in the bitrate switching process.
An important thing to think about when doing network capacity planning is that in a traditional scenario, clients will drop to the bit rate they can sustain on average. In Smooth Streaming, it will continually hop up to the highest they can handle. Smooth Streaming gives each client the highest quality video they can handle. That may result in some network stress for the video provider and network infrastructure if you were expecting video that was less than awesome. ;)
Shiny.
A Q&A from Alex's Smooth Streaming FAQ
Q: Is Smooth Streaming based on Microsoft’s ASF file format? Or does it use some new proprietary file format?
A: No, the Smooth Streaming File Format is based on the ISO-standardized Base Media File Format, better known as the MP4 file format. It follows the ISO/IEC 14496-12 specification
Q: Will Smooth Streaming ensure I can deliver HD video to all my customers?
A: No. Smooth Streaming can’t perform any miracles; it’s simply an enhanced HTTP delivery method. Delivery of HD video is still bound by the efficiency of the codecs used: VC-1, H.264, etc. For example, most video experts would agree that 720p/24 video can’t be delivered at a satisfactory quality level with less than 2 Mbps encoded bitrate. Well, 2 Mbps of encoded video still requires 2 Mbps of network bandwidth in order to be delivered in real-time – and there’s nothing IIS7 or Silverlight can do to change that.
Q: Where can I see Smooth Streaming in action?
A: Visit SmoothHD.com for a demo of on-demand Smooth Streaming, with video content ranging up to 720p HD for those on fast connections (3 Mbps or more). Also check out the IIS.net demo which lets you simulate variable network bandwidth during playback. The only requirement to view Smooth Streaming video is a Silverlight 2 (or better) browser plugin. For a demo of live Smooth Streaming, check out Home Shopping Network’s 24-hr live shopping channel, also offering up to 720p in full-screen mode.
Conclusion
It's really easy to setup and easy to encode for Smooth Streaming. In my case, I just encoded the files off my HD video camera. You'll see more Smooth Streaming around various Microsoft sites that serve video in the coming months.
Have fun!
Related Links
-
-
IIS *LIVE* Smooth Streaming - you can do this with LIVE content also, BTW.
-
Smooth Streaming Multi-Bitrate Calculator - It can be tricky to do the math and figure out what resolutions and bitrates to use for your smooth streaming content so you can use this Silverlight-based online calculator. There's a WPF one also.
-
-
Silverlight Media Framework with Progressive Download Support - If you're going to do a player, this is where you start.
-
"SMF is built on a proven code base with dozens of leading Smooth Streaming deployments, including Wimbledon, Sunday Night Football on NBCSports, the UEFA Super Cup on Canal+, Roland Garros and the Tour de France on France Télévisions and many others and by providing developers with source code they can more easily build these experiences for their deployments. Key features in the framework include DVR, rewind, alternate language tracks, in-stream data feeds and analytics tracking. The SMF is designed for future third-party extensibility and component modularity, as well as support for other media delivery scenarios beyond Smooth Streaming."
-
-
Adaptive Streaming Comparison - "In addition, IIS Smooth Streaming 4.0 will also provide an option for streaming to iPhone and QuickTime X players."
-
- Smooth Streaming Technical Overview
- Adaptive Streaming Comparison
- Smooth Streaming for IIS 7.0 - Getting Started
- Smooth Streaming for IIS 7.0 - Managing Your Presentations
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
The other issue I was having was the best way to secure the URLs with token authorizations - something we need to reduce hijacking. Currently our flash player has an embedded token that authorizes the stream - I couldn't see how to do that with Silverlight and Smooth Streaming.
Our final issue was the player. We, unfortunately, were losing business because there were people from Reddit who came to view our Git series and would not install Silverlight. At first I just let it go - but after the repeated requests (and emails) I couldn't ignore it (we need to eat).
I do appreciate the reach-out from Tim today but it would have been nice to have this conversation 3 months ago :). Hopefully we'll get a FREE episode up on Smooth Streaming with Tim - that would be great.
Good post, as always.
Rob
Max and random Google ID guy, I'll try to get you those answers.
It would be nice to discuss where you can actually host this. It's great to install locally for testing etc but trying to find a host that already has this installed is almost like trying to locate a Sasquatch.
I know we could go and get a dedicated server and then install ourselves but costs obviously rise quickly.
GET /blah HTTP/1.1
Range: bytes=0-999
...
HTTP/1.0 206 Partial Content
Content-Length: 1000
Content-Range: bytes 0-999/10000
...
This is what the iPhone/iPod Touch does: no special software required on the server - it's plain old HTTP 1.1.
Great post, but do you know why IIS cant not agree with the IIS Manager sometimes ?
(Sorry if wrong post)
Is it possible to have a website hosted with a traditional shared hosting company, and to have the video files hosted on Azure and served to the silverlight client using adaptive smooth streaming?
RE>?IIS *LIVE* Smooth Streaming - you can do this with LIVE content also, BTW."
Last time I checked in on this, the ability to do Live Smooth Streaming was limited to hardware devices, such as Inlet's Spinnaker appliance.
I know there is a simulator in the Smooth Streaming SDK to allow the emulation of a "live" smooth streaming using a pre-encoded file, however any information on support real live encoding of video sources from an expression encoder type application/plugin or ideally supported SDK?
I realize that encoding HD content in real-time and into smooth streaming will be very CPU intensive, but would be very interested in tool-sets to do live smooth streaming on our own hardware/software boxes, without requiring third party appliances.
Undeniably, the Smooth Streaming technology is very cool and shows great promise, but until we can readily produce/encode content for both on demand and live scenarios, a lot of us are still relegated to using Microsoft Windows Media Service and the older WMEncoder technologies to get our content on the web.
Any leads on such an encoder SDK?
Herberts - I'm not sure what you are asking?
Luddite - I think so. I'll ask.
NicS - Yes, I don't know of any way to do LIVE *full HiDef* streaming. I've done Live Streaming BTW. I'll ask. Here's an article on setting up Live Smooth Streaming with a Spinnaker.
Max - These are FMP4 files so you could use tools that know how to generate those files. Standard MP4 files are slightly different. However, FMP4 is also a standard.
Duncan - not all proxies/caches honor HTTP 1.1 so we can't always Byte-ranged requests.
Luddite developer - hosters like discountasp.net are now offering Smooth Streaming for hosting accounts. However we dont have Smooth Streaming on Azure yet.
Nick - yes, Live Smooth Streaming today requires special encoders but more and more encoding partners are now supporting Live Smooth Streaming encoding solutions. We don't have a Microsoft tool to do Live Smooth yet.
Google guy (live smooth streaming question) - you are right there sevrer-side requires special logic to make Smooth streaming happen. I am not sure if we have published that in documentation anywhere.
Screencasts may be OK, but it's utterly useless for movie streaming without at least 5.1.
See http://msdn.microsoft.com/en-us/library/cc189080(VS.95).aspx (do a search for "5.1")
What about protected content that only a logged in user can see?
Sounds like a good topic for some Channel 9 videos! The Olympics are a perfect example, as some of the streams require authentication with your cable provider ("entitled content").
It would also be interesting to hear the details on how they are doing the live streaming on such a large for the Olympics.
Now I converted them to ISMV and ISMA files for variety of kbps connections.
Now, how can I play them in a playlist. I don't see any option there even for that?
Can I call ISM files one by one in c# by using PLAYLISTITEM where one ISM is connected with several ISMV or ISMA files.
Hence this way, I can individually play different content mixed audio and video encoded separately for smooth streaming via the playlist?
Please confirm.
Thanks.
Now I converted them to ISMV and ISMA files for variety of kbps connections to use Smooth Streaming.
Now, how can I play them in a playlist. I don't see any option there even for that?
Can I call ISM files one by one in c# by using PLAYLISTITEM where one ISM is connected with several ISMV or ISMA files.
Hence this way, I can individually play different content mixed audio and video encoded separately for smooth streaming via the playlist?
I mean would this work:
PlaylistItem item = new PlaylistItem();
item.MediaUrl = new Uri("url/filename1.ism" + "/manifest");
item.IsAdaptiveStreaming = true;
base.Playlist.Add(item);
item.MediaUrl = new Uri("url/filename2.ism" + "/manifest");
item.IsAdaptiveStreaming = true;
base.Playlist.Add(item);
item.MediaUrl = new Uri("url/filename3.ism" + "/manifest");
item.IsAdaptiveStreaming = true;
base.Playlist.Add(item);
Here filename1.ism contains information of several ISMV files, filename1.ism contains information of several ISMA files...
Please confirm if this would work like a playlist rather than creating ONE SINGLE file as WMV by joining Video and Audio and then creating single ISM file?
Thanks.
Love,
Rishi
Comments are closed.