DevX HomePage

Silverlight Streaming: Free Video Hosting for All

Video has long been the bane of developers for lack of hosting and bandwidth. But with Microsoft® Silverlight™ Streaming, almost anyone can get their videos online quickly, easily and for free.

Silverlight, as Microsoft's entry in the Rich Internet Application arena, is designed to permit developers using Microsoft technology and tools to quickly build and deploy web applications containing extensive graphics, animations and videos. Unless you are a large corporate developer with unlimited storage space and an OC3 Internet connection, hosting this type of content can be a challenge. Videos can consume huge amounts of storage space on a server and lots of bandwidth if they become popular, turning your graphically intense web site into a cost prohibitive venture. To help those lacking big iron and fat pipes, Microsoft has sent Silverlight Streaming to your rescue.

There are two distinct types of Silverlight content which can be hosted on Silverlight Streaming: Silverlight applications—principally XAML based Silverlight UserControls contained in .xap files—and audio and video files. Clearly the principal goal of Silverlight Streaming is to provide low cost, high bandwidth hosting for videos delivered to clients running Silverlight applications. But don't think Microsoft has completely moved into the web hosting business. Silverlight Streaming is not intended as a general purpose web hosting site due to the fact that the allowed file types do not include either .html or .aspx files.

Silverlight Streaming allows up to 10 GB of hosting space per account. Individual files cannot exceed 105 MB in size. This works out to a maximum video bit rate of 1.4 Mbps ((105 x 8) / (10 x 60)). There is a limitation of 5 TB of aggregated bandwidth per month per account. During the beta period for this service, hosting is free. After the service goes gold, hosting will remain free with advertising or will be available for a "competitive" fee without advertising.

A pilot program for Silverlight Streaming advertising was recently introduced and it turns out that not only is hosting with advertising free-of-charge, but participants can actually earn advertising revenues. As of this writing, Microsoft is still accepting more participants in this advertising pilot program, so if you are interested, you can apply here.

Creating a Silverlight Application for Deployment on the Silverlight Streaming Web Site
The MSDN® help files for Silverlight Streaming include a set of step by step instructions for creating a simple Silverlight application for use with the service. I followed these instructions (with a few modifications here and there) to create a Camtasia video. For output I selected the settings for a size of 640 x 480 with best quality video and audio. The file size for the resulting 12 minute .wmv file was 33 MB.

Figure 1. A sample video served from Silverlight Streaming (click to play)

For comparison purposes, I also created a Flash version of this screen cast, using equivalent settings for size and quality. The file size for the resulting .flv file was 40.1 MB.





Using Expression Encoder 2
My next step was to use Expression® Encoder® 2 to encode this file for hosting on Silverlight Streaming. The purpose of Expression Encoder is to compress a video file to its smallest possible size given the constraints of its intended distribution channel—web, CD, DVD, LAN or iPod/Zune. Since there is a tradeoff between file size and image quality, a video file intended for use in a Silverlight web application will normally use greater compression even at a cost of image quality in order to provide the best overall user experience.

Expression Encoder is also capable of editing a video file to add or delete segments, as well as to add titles, pre-roll and post-roll advertising and captions. Since most users will also want to control the video (Play, Pause, Seek, Fast Forward, Reverse), Expression Encoder includes a collection of "Templates" representing various styles and designs of playback controls. This collection of templates is extensible so if you prefer to create your own design, it's easy to do so.

While it is possible to preview all of the included templates directly in Expression Encoder itself, I found the images of each player to be too small to properly evaluate, so I have posted screenshots of each one on my blog. Also included are links to live samples (delivered from the Silverlight Streaming server, obviously).

Figure 2. A sample of playback controls

The range of settings available in Expression Encoder is very extensive and can be quite intimidating to anyone with only minimal (or non-existent) video editing experience. Expression Encoder uses a collection of presets—termed "profiles"— to cover most scenarios. For Silverlight web applications the principal choices of profiles take into account two key factors: (1) the anticipated connection speed of projected users (on a scale from dialup to broadband) and (2) the simplicity or complexity of the video content (on a scale from screencast to a fast paced sporting event).

For slower connection speeds, Expression Encoder uses a higher compression algorithm. If the video content is almost entirely either simple content such as a screencast or complex content such as a sporting event, a Constant Bit Rate (CBR) encoding is generally recommended. On the other hand, if the video consists of a mixture of simple and complex content, a Variable Bit Rate (VBR) encoding is typically preferred.

Below is a table which shows the names of six profiles which apply to different combinations of these parameters. For example, from this table you can see that the maximum speed CBR is called "Streaming Broadband" and the slowest speed VBR is called "Web Server 256 K DSL".

Table 1. Expression Encoder Profiles for Constant Bit Rate and Variable Bit Rate Encoder

Table 2 illustrates the results of encoding my first Camtasia video. It shows for each profile, both the estimated and actual file sizes, along with the actual time required for encoding. In addition to the six profiles shown in the first table, this table includes the Screen Encoding profile which was explicitly designed to cover screencasts.

Table 2. Example file sizes and encoding times for Expression Encoder

You can view the results of each process by choosing the appropriate link:






Publishing Plugin for Expression Encoder 2
In June, Microsoft released a Publishing Plugin for Expression Encoder 2 to facilitate uploading videos to the Silverlight Streaming web site. This plugin is highly recommended because it almost fully automates the uploading process. Simply enter your Account ID, Account Key and a name for your video / application and the plugin takes care of everything else. One very useful feature is that the plugin allows for partial updates, thus uploading only those files which are different from the ones already stored on the Silverlight Streaming web site.

The Publishing Plugin must be downloaded from the Microsoft web site and its installation must target a folder named Plugins which is located in the root of the Encoder 2 application folder. (If you don't always accept default locations for your applications this tip can help explain why the plugin may not immediately show up in your working copy of Expression Encoder.)

Again using Camtasia, I created a screencast which walks through the steps for using the Expression Encoder Publishing Plugin. After creating this video using Camtasia I encoded it in Expression Encoder for use with Silverlight and then uploaded it to the Silverlight Streaming web site using the Publishing Plugin. You can watch this screencast here.

Streaming
Broadband

Streaming
512 K DSL

Streaming
256 K DSL

Web Server
Broadband

Web Server
512 K DSL

Web Server
256 K DSL

Screen
Encoding

Figure 3. Hosting a Non-Screencast Video on the Silverlight Streaming Web site (click to play)

If you already have a video which you would like to include in your Silverlight web application, the process of encoding and deploying it is very simple. The first step is to import your video into Expression Encoder. Then choose the appropriate settings, configure the Publishing Plugin and press the Encode button. That's it.

Of course, the reason why that explanation sounds so unreasonably over simplified is that it assumes that you will accept all—or at least most—of the default settings and that you do not wish to edit your video, add any overlays or callouts, fade-ins or fade-outs, etc. Naturally, if you wish to fine tune your video, the process becomes considerably more complicated. But if your video is ready to use in an "as is" condition, the entire process is simple if you use Expression Encoder.

More surprisingly, it is just as easy to upload a video to Silverlight Streaming without Expression Encoder, merely by using the Silverlight Streaming web-based UI. In that case, the Silverlight Streaming web site performs some onsite encoding to reduce the bandwidth requirements of your video (a before and after comparison of the video quality clearly shows that the video delivered from Silverlight Streaming has been modified). Moreover when users access your video, a generic player is provided as shown in the following screenshot.

Figure 4. Generic video player included in Silverlight Streaming (click to play)

As you can see from a comparison of all of the Expression Encoder templates, this generic player turns out to be identical to Corporate Silver. So even without Expression Encoder, Silverlight Streaming can provide you with two essential benefits: on-the-fly video compression and a built in player.

You can see a screencast showing how to upload a video using just the Silverlight Streaming UI here.

Figure 5. Screencast to show how to upload a video using the Silverlight Streaming UI (click to play)

Conclusion
Including video content in a Silverlight web application can be an almost painless task, thanks to the free (or at least low cost) content hosting provided by Silverlight Streaming. Expression Encoder, while technically not required to either process or upload video files, gives you full editing and preparation control over any video.

While Silverlight Streaming permits the hosting of both applications and videos, its real benefits are clearly associated with videos. While most XAML-based application content will likely continue to be hosted on general purpose web hosts, there are some major advantages to using Silverlight Streaming for your video content. If you have been considering adding some video to your web site, there is no longer any reason to hesitate.

Useful Links