Dynamic streaming (Adaptive bitrate) using Flash media Server

Video can be downloaded (progressive download) to the client like YouTube or can be streamed to him.

I won’t discuss the pro’s & con’s of streaming and progressive. We’ll only be discussing streaming in this post.

So, What is the post worthy problem we have when streaming video to the client?

Continue reading and find out. When streaming video, you usually encode your video in a certain bitrate. This bitrate will work well in certain computers and won’t work well in others. Why is that?

That’s because each of your users has a different connection thus being capable to receive a limited amount of bytes streamed to him. So, you always have to find the “sweet spot” where you deliver a video that looks good and also light enough to fit a wider range of network connection speeds.

That is of course a problem, becuase sometimes you want to stream hiQuality video and audio (HD) and you can’t, because some of your users won’t be able to watch it smoothly. Well, this is a problem we will solve here in this post.

Flash media server

That way, you can create several encodes to the same source movie and supply a movie best fit to the user cosuming it.

Another obvious advantage of this approach is the way it skips on top of the movie, when you skip to a further point in the movie, you are actually being supplied a different movie from the lowest quality to the highest.

So, how is it done, first, let’s create a flash file (I’m using flash CS4).

Now, we will create (by dragging and dropping from the components panel) an FLVPlayback control.

We will give it the same dimensions as the movie itself so it will fill the entire surface.

Now, we will give the player an instance name of “flvPlayer”

So, we have a movie, we have an FLVPlayback control, we called it “flvPlayer”.

We will create another layer, called “action script” and we will create this code inside.

import fl.video.*;
VideoPlayer.iNCManagerClass = NCManagerDynamicStream;
flvPlayer.source = "dynamicStream.smil";

OK, so as we can see, we created a pointer to a file called “dynamicStream.smil”, this is a special file (XML format).

This file details the following:

  • FMS Url
  • Files you have encoded and a network speed in correlation
The file looks like this:

xml /xml

Now, when we put this file on our web-server, the user will get the file it can receive and play, not slower, not faster, just the perfect file for him.

NO buffering, NO waiting, NO frustration, smooth, cool and fast user experience.

Good luck!

You can download the complete solution from here: download id=”3”

<img src="http://feeds.feedburner.com/~r/KensoDev-en/~4/z0l06oPegI4" height="1" width="1"/>
Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com