Live IIS Smooth Streaming in Expression Encoder 4 Pro
Authors: Jamie Lang and Sam Wookey
About the Authors: Jamie Lang is a program manager and Sam Wookey is a software developer on the Expression Encoder team.
Microsoft® Expression Encoder 2 was the first version of Encoder to support encoding content into the IIS Smooth Streaming format. In Expression Encoder 4 Pro, we have taken this support one step further with the introduction of Live Smooth Streaming. Now, you can stream audio and video from your webcam or capture card directly to an Internet Information Services (IIS) server with the latest IIS Media Services installed. Live Smooth Streaming content is delivered over existing HTTP networks, thus reducing the custom infrastructure needed to broadcast a live event. CDNs and content providers no longer have to worry about how much capacity they can dedicate on their much-more-resource-constrained streaming networks. They can take advantage of all the resources of their HTTP network and do not have to worry about maxing out network capacity and shutting out users from live events. For a user viewing a Live Smooth Streaming broadcast, they no longer need to worry about watching a video feed tailored to the lowest common denominator of consumer hardware. A Live Smooth Streaming broadcast contains different video quality levels all the way up to true HD quality (720p+), allowing users on mobile devices and the fastest PC’s to consume video
from the same stream at a quality level appropriate for their platform.
Live IIS Smooth Streaming is only available in the Pro version of Expression Encoder. You can purchase it
individually or as part of
Expression Studio 4 Ultimate.
In the rest of this article, we are going to walk through the steps needed to get up and running to broadcast your first Live Smooth Streaming event. At the end, we have included a few links where you can find more information about Live Smooth Streaming and ways that you can take advantage of it for your particular application.
Setting Up IIS Media Services
The first step in using Live Smooth Streaming in Expression Encoder 4 Pro is to download and install IIS Media Services for Internet Information Server. IIS Media Services provides the server-side component which distributes Live Smooth Streaming content to clients (or other edge servers). IIS Media Services can be installed using the
Web Platform Installer (WPI) or from the
IIS download site. You’ll need the following prerequisites prior to installing IIS Media Services:
- You must use IIS 7 running on one of the following operating systems:
- Windows Server 2008
- Windows Server 2008 R2
- Windows Vista with SP1
- Windows 7
- To manage IIS Live Smooth Streaming using the IIS Manager user interface, the IIS Management Console for IIS must be installed.
The IIS site contains an excellent
tutorial on installing and configuring the IIS Media Services. This page gives you step-by-step directions on installing Live Smooth Streaming support on the server, creating your first publishing point, and testing your installation using sample content.
Live Smooth Streaming in Expression Encoder 4 Pro only supports Push mode on a publishing point. This means that Encoder will push content to the IIS server (as opposed to Pull mode, where the IIS server will pull video from a support encoder). It is important to make sure that all publishing points you create that you wish to use with Expression Encoder 4 Pro have the Push option selected under the Live source type combo box, as in Figure 1 below.
Figure 1. Live source type combo box with Push option selected
With the new IIS Media 4.0 module, you can also set up the publish point to transmux the stream into a format compatible with Apple mobile devices along with an .m3u8 format manifest. This will require that the Expression Encoder is streaming using H.264 Baseline (iPhone) or H.264 Main (iPad) profiles. When setting up the publish point, there will be a new tab called Mobile Devices. Checking the Enable output to Apple mobile digital devices will enable this feature. Then you can set up a webpage using an HTML5 video tag to point to the new .m3u8 manifest:
For more information, see the Apple HTTP Live Streaming
article on the IIS site.
Configuring Expression Encoder
Now that you have installed the required server side components, we can begin using Expression Encoder 4 Pro to start broadcasting some content. The first step after installing Expression Encoder 4 Pro is to create a new Live Broadcasting Project from the New Project window.
Next, we need to choose the sources that we are going to use to broadcast. Expression Encoder 4 Pro can broadcast from a range of different sources, including video and audio capture cards, still pictures, and audio and video files. All of the live encoding functionality that was supported in past versions of Encoder, such as switching between different sources, looping file sources, jumping from one file source to the next, and configuring all of your source properties, are supported for Live Smooth Streaming broadcasting. Also, make sure you remember to Cue the source you want to begin broadcasting with. The Start button stays disabled until you Cue one source to start with.
After you have added all of the sources that you wish to broadcast from, it is time to configure your encoding settings to use Live Smooth Streaming. To make this easier, we have created many built-in presets to get you started. Expression Encoder 4 Pro supports creating Live Smooth Streaming content using either the VC1 or H.264 video codecs, giving you the flexibility to distribute your content on a whole range of different clients and devices. Microsoft Silverlight®clients support the playback of both types of content, but if you wish to broadcast to clients such as an iPhone, you will need to use one of the H264 presets.
Figure 2. Encoder live preset panel
The built-in presets will get you started with some basic settings to get you broadcasting quickly. If you wish to configure these settings further, you can find all of the options you want under the Video and Audio tabs. Each stream supports different settings for bit rate and size, and using the various tabs, you can add and remove streams, as well as configure the settings for each stream. See the Tuning Your Broadcast section below for suggestions on optimal settings for your encoding machine.
You can also change the Advanced Video Encoding Settings for the overall broadcast by expanding the chevron under the Video settings expander. However, unless you know what each setting does, it’s best to leave these as the defaults from one of the presets for Live Smooth Streaming, as some of these settings can have a very detrimental effect on your broadcast. Some settings, such as Closed GOP, cannot be changed, as they will create an invalid Live Smooth Streaming broadcast.
Figure 3. Configuring individual streams
Now that you have established that you are creating a Live Smooth Streaming broadcast, you can set the location to push the broadcast. On the Output tab, click on the Streaming checkbox to enable pushing a broadcast to an IIS Live Smooth Streaming enabled server. By default, the Publishing Point radio button is enabled. Broadcast mode is disabled when a Live Smooth Streaming output format is selected.
Type the location of your Live Smooth Streaming publishing point into the Location combo box (Figure 4). The publishing point URL looks like http://<server name>/<virtual directory>/<name>.isml. The <name> for the publishing point comes from the file name you chose when creating the publishing point on the server.
Figure 4. Selecting a publishing point
Live Smooth Streaming publishing points behave differently than Windows Media Services publishing points, so if you are familiar with WMS publishing, there are a couple caveats to keep in mind. Live Smooth Streaming publishing points aren’t created automatically like WMS ones, and they don’t start automatically either when you start streaming to them. They must be created manually on the server and they must be started before broadcasting. You can set the ‘Start publishing point upon first client request’ checkbox on the Advanced tab of the Edit Publish Point dialog to have it start when the broadcast starts.
Also, a Live Smooth Streaming publishing point must be reset on the server if you wish to broadcast to it multiple times. Each time you start and stop encoding, you must shut down and restart the publishing point on the server before you can connect to it again. Otherwise, data from the last run will still be on the server and you will encounter errors while broadcasting the next time. This is the most likely source of errors you will receive from the server when using Live Smooth Streaming in Expression Encoder, and your first course of action should always be to shut down and restart the publishing point on the server before trying to broadcast again.
After you have chosen the publishing point in the Location combo box, click Connect to test your connection to the server. If you have enabled authentication on the server, you will be prompted for your access credentials. If your credentials are accepted and your publishing point is set up properly, then the Connect button will turn green and the status will say Connected. If you encounter any errors while connecting, or your publishing point is invalid, the Connect button will turn red and an error message will show in the status area.
Now that you have chosen your sources, selected a Live Smooth Streaming output format, and chosen your publishing point, you are ready to begin your broadcast. Click the Start button to begin encoding.
There are a few errors that you may encounter while broadcasting. During broadcasting, if Expression Encoder detects that the number of dropped frames exceeds a minimum threshold, it will show a warning that the playback experience may not be optimal. Broadcasting will not be stopped with this warning, however.
Figure 5. Dropped frames warning
Errors can occur as well if the source device or file cannot send information fast enough to send a full chunk to the server. This usually happens on the lower bit rate streams where the bit rate cannot be written fast enough for the key frame interval which will cause the streams to be out of sync. If this happens, encoding will fail and you will need to increase the bit rate of the lower streams to make sure there is enough data in these chunks.
Figure 6. Bit rate too low error
A third type of error can occur when the source content changes frame rates. This can happen with some live devices like webcams that reduce the frame rate in low light conditions or it can happen in variable frame rate video files. When these types of inputs are used as sources, the chunk lengths of the video stream can vary greatly and cause sync issues with the audio stream during playback for long encodes. To prevent these types of errors make sure the live devices or files can maintain a constant frame rate during broadcasting.
Setting up Your Silverlight Client
The third piece in the Live Smooth Streaming ecosystem is the client used to play back a Live Smooth Streaming broadcast. Any number of different clients can be used to view a Live Smooth Streaming broadcast. The
Silverlight Media Framework contains a default Silverlight client that you can use to test your streams. If you followed the instructions on the Live Smooth Streaming for IIS 7
tutorial to create and test a publish point, then you already have installed a sample player under %SystemDrive%\inetpub\wwwroot\LiveSmooth (unless you installed the Silverlight Media Framework to a different directory). You can use the default player in this development kit to test out your streams. It includes a graph which displays information such as the current bit rate that is playing, the current bit rate that is downloading, and the current frame rate that is playing. If you wish to use this template to view the streams you are publishing from Expression Encoder 4 Pro, then you need to update the mediaSource attribute in the default.html page to point to the publishing point that Encoder is pushing to. Note that the mediaSource attribute is the fully qualified URL that you entered into the Expression Encoder 4 Pro Location combo box, plus the added tag </Manifest> at the end. So for example, if in Expression Encoder 4 Pro you entered http://server_name/LiveSmooth/LiveSmoothStream.isml as your publishing point, then the mediaSource attribute in the default.html would be http://server_name/LiveSmooth/LiveSmoothStream.isml/Manifest.
For a more complete client experience, you can also use one of the media player templates that are included in Expression Encoder 4 Pro. The video templates that you can select when you choose a new Silverlight Project support Live Smooth Streaming broadcasts. To use one, you need to update the playlist in a published template. Here is how you can get a published template from Expression Encoder 4 Pro and update the playlist to point to your Live Smooth Streaming broadcast:
Figure 7. Expression Encoder 4 Pro Silverlight templates
- Start a new Silverlight Project in Expression Encoder 4 Pro.
- Import any video into the media content panel. It doesn’t matter which video is added here, since you are going to replace the MediaSource entry in the template for this video with the location of your Live Smooth Streaming publishing point. Try to pick the sample video files or something with a short duration. If you pick a WMV file that is supported by Silverlight, then you can choose Source Profile settings to eliminate the encoding step and speed up the overall publish.
- Next, choose the template that you wish to use from the Templates palette. All of the templates except the audio-only ones support Live Smooth Streaming content.
- Click Encode to publish your sample video with the selected template.
- Now that you have generated a template, you need to update the playlist in the default.html of the published output. Open the location where you published your template (in the Output tab in the Silverlight Project, under Job Output, there is a Output Options menu where you can choose Open job location which will take you directly to your published template).
- Using Notepad (or a similar text editor), open the default.html file in your output directory.
- Look for the <PlaylistItem> tag. It will look something like this:
<Description>This is a description of this item</Description>
<Title>Wildlife in HD</Title>
- In the above example, a smooth streaming output format was chosen in the Silverlight Project, hence the MediaSource attribute points to an offline Smooth Streaming file, and the IsAdaptiveStreaming attribute is set to “true.”
- Update the above XML to point to your Live Smooth Streaming publishing point. For example, you would change the MediaSource attribute to look something like this:
- You will also need to set some of the other attributes. The Width and Height should be the width and height of the largest stream in your Live Smooth Streaming broadcast. Also, VideoCodec and AudioCodec should reflect the settings in your broadcast (either VC1 or H264 for Video, and AAC, WMA, or WmaProfessional for Audio). Make sure that IsAdaptiveStreaming is set to “true.”
- Now, copy all of the files in your publish directory to the server where you would like to host your site. You do not need the video file that you used as a placeholder, just make sure to get all of the .xap, .html, and .png files in that directory. Typically, you would host this HTML page on the same server that you installed IIS Media Services, as this will eliminate any cross-domain Silverlight issues that might occur.
- Navigate to the default.html page you just put on your server and watch your Live Smooth Streaming broadcast.
Tuning Your Broadcast
Live Smooth Streaming encoding is a very computationally expensive process, and requires a fast machine to get good results. For example, you cannot encode 12 720p streams on a dual core laptop. More memory, faster CPUs, and more cores will all enable you to encode more streams at higher qualities. To encode at 720p quality levels, you are also going to need to make sure that these cores are fast. Having eight cores running at 2.0GHz is good configuration, but having four cores at 3.0+GHz is better, especially if you want to encode at 720p. Often, it will take experimenting with encoding settings to find out what a particular machine can handle. Pay attention to the number of dropped frames while encoding, as Expression Encoder will drop frames when it detects that it cannot achieve the current encoding settings. Dropping frames is usually a sign that your machine is not fast enough to encode using your current settings. Reducing the number of streams, lowering the bit rate of individual streams, and reducing the output resolution of each stream will all result in better performance.
The Expression Encoder team has created a tool that can allow you to test your hardware’s ability to broadcast live IIS Smooth Streaming. It allows you to select a file type and an Expression Encoder live preset to test against. It also has additional options to specify the failure tolerance or you can let the tool generate the optimal streams during the test. Then Expression Encoder will iteratively run the file through different IIS Smooth Streaming broadcast scenarios and will complete when the output meets the failure tolerance requirements. Once finished, you can save the generated preset so that it can be used with Encoder. It is recommended that you use different file types to determine a more accurate prediction on your hardware’s capabilities, since decoding different codecs can affect broadcasting.
You can download this
tool from the Expression Gallery website.
Protecting Your Output
In Expression Encoder 4 Pro, you can also encrypt your output IIS Smooth Streaming broadcast using Microsoft PlayReady® technology. You will need to have a PlayReady license server or provider set up to obtain a Key Seed which will allow the server to decode and send a license to the client during playback. On the Output panel, check the Digital Rights Management checkbox to enable the feature.
Figure 8. Digital Rights Management
In this section, you will need to enter:
- License URL: Enter the URL to the server that will provide the license. This URL should point to http://[servername]/playready/rightsmanger.asmx. Click the Validate button to verify the URL is correct.
- Key ID: This field is a unique GUID to identify the broadcast. Clicking Generate
- will create a new GUID automatically.
- Key Seed: This string should be the base64 encoded string provided by the
- license server to be used to encrypt the streams. The Key Seed is used to encrypt the content and has to match the server’s Key Seed so the server can provide the correct license to decrypt the content.
Silverlight handles the license request and downloads during playback on the
client. You can use any of the Expression Encoder 4 Pro templates to play back encrypted content.
Here are some sites where you can find more information about Expression Encoder 4 Pro and Live Smooth Streaming:
You can purchase Expression Encoder 4 Pro as well as find news about product releases and other resources from the Expression Encoder website.
Expression Encoder Team Blog is a great place to stay up-to-date with the latest information about Encoder releases and tips and tricks on using Encoder.
If you have any questions about using Expression Encoder 4, the
Expression Encoder forum is a great place to start. Here, you can connect directly with the Encoder team and other users to ask questions, request features, and get help with any problems you might be having.
IIS Media website has a wealth of information about Live Smooth Streaming.
Here, you will find instructions on setting up your server, sample content, comparisons against competing formats, and case studies about other companies using Live Smooth Streaming technology.
If you are interested in developing your own media player to consume Live Smooth Streaming content, then the
Silverlight Media Framework is the first place you
There is also a
white paper from the IIS team on how to set up live IIS Smooth Streaming in Expression Encoder to stream to Apple Devices.
This document is provided “as-is.” Information and views expressed in this document, including URL and other Internet website references, may change without notice. You bear the risk of using it.
This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal reference purposes. You may modify this document for your internal reference purposes.