Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Smooth streaming low quality on start

I m hosting some adaptive streaming video on windows azure and I have noticed that at the beginning the video start with the lowest avaiable bitrate. That is a big issue.

I have seen by searching the internet that a trick can be done by hooking the manifestready event and removing the lowest bitrates and then adding them back after some time. It make sense but I have seen no sample code of doing that.

I got the player code from expression encoder 4 and had a look but found nowhere where to do the change.

Does someone have more info on improving startup for smooth streaming?

Thank you very much

like image 808
fred_ Avatar asked Aug 25 '11 11:08

fred_


People also ask

What is the IIS live Smooth Streaming extension?

The IIS Live Smooth Streaming extension for Internet Information Services (IIS)allows you to set up a web server as a Live Smooth Streaming server that delivers compelling, uninterrupted live video streams that instantly adjust quality (bitrate) to match changing network and CPU conditions at the client.

Is it possible to set up a Smooth Streaming Server?

Thank you. The IIS Smooth Streaming extension for Internet Information Services (IIS) allows you to set up a Web server as a Smooth Streaming server with a default Microsoft Silverlight client implementation. This walkthrough covers the following scenarios:

How do I add live Smooth Streaming publishing points in IIS?

In IIS Manager, select the desired website or virtual directory, and then double-click the Live Smooth Streaming Publishing Points icon. On the Live Smooth Streaming Publishing Points page, in the Actions pane, click Add. In the Add Publishing Point dialog box, on the Basic Settings tab, enter the following information: File name.

How do I use IIS Smooth Streaming presets?

Be sure to choose a preset with IIS Smooth Streaming in the preset name, and then click Apply. To find out more information about a preset, such as the numbers of streams in the output and the codecs used, hover your mouse pointer over a preset name.


1 Answers

Hello I posted the question to the Media Platform Player forum and got an answer that works.

The discussion is here: http://smf.codeplex.com/discussions/271042

Here is the code I use:

public MainPage() {
        InitializeComponent();
        player.MediaPluginRegistered += new EventHandler<CustomEventArgs<IMediaPlugin>>(player_MediaPluginRegistered);
        player.PlayStateChanged += new EventHandler<CustomEventArgs<MediaPluginState>>(Player_PlayStateChanged);
    }
private IAdaptiveMediaPlugin _adaptivePlugin = null;
private bool isStartupHeuristicsActive = false;

void player_MediaPluginRegistered(object sender, CustomEventArgs<IMediaPlugin> e) {
    var adaptivePlugin = e.Value as IAdaptiveMediaPlugin;
    if (adaptivePlugin == null) return; 
    if (_adaptivePlugin == null) _adaptivePlugin = adaptivePlugin;
    _adaptivePlugin.ManifestReady +=new Action<IAdaptiveMediaPlugin>(_adaptivePlugin_ManifestReady);
}

void  _adaptivePlugin_ManifestReady(IAdaptiveMediaPlugin obj)
{
    if (_adaptivePlugin != null)
    {
        var videoStream = _adaptivePlugin.CurrentSegment.SelectedStreams.Where(i => i.Type == StreamType.Video).FirstOrDefault();

        if (videoStream != null)
        {
            var averageBitrate = videoStream.AvailableTracks.Average(t => t.Bitrate);

            var track = videoStream.AvailableTracks.FirstOrDefault(t => t.Bitrate >= averageBitrate);
            if (track != null)
            {
                isStartupHeuristicsActive = true;
                videoStream.SetSelectedTracks(new[] { track });
            }
        }
    }
}

private void Player_PlayStateChanged(object sender, CustomEventArgs<MediaPluginState> e)
{
    if (isStartupHeuristicsActive && e.Value == MediaPluginState.Playing)
    {
        isStartupHeuristicsActive = false;
        if (_adaptivePlugin != null)
        {
            var videoStream = _adaptivePlugin.CurrentSegment.SelectedStreams.Where(i => i.Type == StreamType.Video).FirstOrDefault();
            if (videoStream != null)
            {
                videoStream.SetSelectedTracks(videoStream.AvailableTracks);
            }
        }
    }
}

Thank you

like image 191
fred_ Avatar answered Sep 23 '22 15:09

fred_