Sound Quality

Some of you may know that I have tried my hand at encoding video. I have come up with settings that I have found work fairly well in Adobe Connect. With that said I have always turned down the quality of the audio but wondered if people actually noticed. I found an article with audio samples that tells me that they may not. Give it a try and let me know how you did on the tests.

Flash Media Server 4 brings Multicast to Flash Video

In case you missed it Adobe announced Flash Media Server 4 . This is a significant release for a number of reasons. The first reason is that many corporate customers have been interested in Flash video but were not able to take advantage of it with out support for IP Multicast as this technology was a mandate from their IT organization. In other words this update for the Flash Media Server to version four gets you a 64bit architecture, Absolute timecode, faster seeking, trick mode playback (fast motion, slow motion, and frame stepping), intelligent reconnect, faster switching for RTMP Dynamic Streaming and IP Multicast Support.

Using version 4  of the interactive edition of the Flash Media Server gets you the ability to choose between Unicast (with or with out Origin / Edge), IP Multicast and even Live HTTP Dynamic Streaming. It is even possible to failover from IP Multicast to a Unicast stream if necessary. When you consider all of the possibilities they include:

  • Interactive applications that support video, audio and data for one to many and many to many for both live and video on demand
  • Large scale broadcasts using IP Multicast
  • Origin / Edge solutions that can be used to intelligently reduce bandwidth requirements for vod
  • Failover for complex environments with different network requirements (e.g. remote sites, vpn)

That is a short summary of the possibilities that you get with the interactive edition of the Flash Media Server but that was not the only announcement. Adobe also announced Adobe® Flash® Media Enterprise Server 4. If you are not familiar with RTMFP that would be a good place to start. This peer protocol will allow you to take advantage of users / viewers upstream bandwidth to broadcast video, audio and data in your application and now the Flash® Media Enterprise Server 4 can participate in those groups. So consider the limitations of a peer broadcast. First you will only have access to the one video codec that can encode that is part of the Flash Player and that is Sorenson Spark. If you are familiar with Sorenson Spark you know that the quality leaves something to be desired. When you consider that the Flash® Media Enterprise Server 4 can act as a peer using RTMFP you now have access to all of the varied video formats that can be broadcast using the server (On2, H.264,…). It is also important to note that you are not limited to just video when you are using Peer Assisted Multicast (RTMFP) you can include data as well. These applications can include interactivity unlike IP Multicast. Of course there are considerations that include additional latency based on the number and location of peers in a group but the possibilities are amazing. Just consider an internet based application that includes video and interactivity with 10k concurrent users. With out a peer solution you would have to invest in a significant number of servers as well as a significant amount of bandwidth. With the Flash® Media Enterprise Server 4 you could address both server and bandwidth requirements with a small fraction of what it would take with a Unicast solution. The cost savings will be significant.

Test Media Player

After numerous calls to help people confirm that the server was working correctly I decided to write a media player that would help test and confirm the ability to stream video from the Flash Media Server. This player is provided as is with no warranty or support but I hope you will find it useful. This is an AIR based player.  I created it for AIR for a number of reasons not the least of which that it was easy to install and run locally with out the need for an http server. I have already thought of a few additions so let me know if you find it useful. It is simple to use, just enter the url to some media on an FMS server in the following form:

URL Syntax: rtmp://[servername]/[application]/[streamname+extension]

1)     [servername]: this is the IP Address, or the domain name of your server. (i.e. localhost)
2)     [application]: use “vod” unless you have created a new directory in the application folder of the Flash Media Server installation directory. There are two built in applications vod and live.
4)   [streamname]: use the name of your video file (including the extension). The extension can be flv, f4v or mp4. You do not need to prefix the file name with the content type (e.g. mp4:).

The application reports Current Bitrate, Dropped Frames as well as Max Bytes Per Second and other useful messages. When you stop the video you will be presented with a graph and grid of the captured data.

AIR Test Media Player
AIR Test Media Player

You can download the application here.

High Quality Video In Adobe Connect

This article assumes that you have some knowledge of and access to an Adobe Flash Media Server as well as the free live encoder from Adobe called the Flash Media Live Encoder.

I wrote a simple custom pod that will allow you to stream high quality live video from the Flash Media Server to the free custom pod mentioned here that is being shared in a meeting room in Adobe Connect. For now the custom pod only supports live video not vod (file based video).

This approach does not nullify bandwidth requirements but it allows you to benefit from the capabilities that Flash Media Server provides around streaming high quality video.  In other words if you stream a 2 Mpbs video to this custom pod hosted in a Connect meeting room the attendees of that meeting room will need more than 2Mbps to view it. The reason they will need more than the video requirement is that the Connect meeting room as a bandwidth requirement as well that needs to be taken into account.

When you download the custom pod you will notice that it is just a Flash file (swf). This custom pod is provided free as is with no support. Open an Adobe Connect meeting room. Open a share pod if one is not already open and click the button labeled “Documents” from the popup menu select “Select from My Computer…”. Navigate to the custom pod (fmsVideo.swf) select and upload it to the meeting room.

Notice the green dot in the upper left hand corner of the custom pod. That is used to open and close the settings. The setting will automatically close when the custom pod makes contact with a Flash Media Server. It also functions as a visual indicator of your connection state. Green indicates that you are connected and red indicates that you are not connected. The indicator does not change immediately when you connect or disconnect there may be a several second delay between changes in that indicator.

You will also notice in the preceding  screen (custom pod) that only two elements are required in order to play the live stream ( server url starting with rtmp and the stream name). These elements  correspond to settings in the Flash Media Live Encoder output panel.

Once you have the stream published from Flash Media Live Encoder to the Flash Media Server simply copy and paste the FMS URL and Stream (name) from the Flash Media Live Encoder into the same fields in the custom pod and hit the connect button. That should do it.

You can download the custom pod here.

Online Searchable Video


Imagine finding the perfect training video but it is an hour long and you need to find the specific part of the video that covers your specific interest. Or possibly you are an advertiser and you would like to have content aware advertising in some specific online videos.  You would like to have your advertising show up on a page when a specific word is mentioned in a video or maybe when a video is searched for a specific word, does that sound familiar it should as it is the google model for advertising and now it can apply to video.

The solution that I will cover in this article will allow you to transcribe the spoken word in videos into text and allow a user to search that text to find relevant areas of the video. The example that we will cover is only the beginning. I could imagine an entire searchable library of video or possibly even a web search engine that easily finds and displays video starting at the location where the search engine found a word that was spoken in the video. Before we jump in it might be helpful to see an example.


In order to create the transcription you will need either Premiere® Pro CS4 or Adobe® Soundbooth® CS4.  My opinion is that if you are going to do any serious video editing you should consider Adobe® Creative Suite® 4 Production Premium as it contains everything you will need to edit, composite and publish high quality video projects.

Getting Started:

I should start by telling you what I am not going to cover. I am not going to cover how to get started with Premiere Pro, Soundbooth and the Flash Media Server. There are a number of great resources for each of these products. What I am going to cover is the specific functionality in each of these products that relate to creating searchable video. Lets start with Adobe Premiere Pro.

Once your project is created and the video and sound edited to your satisfaction it is time to transcribe the video.  This is a very straight forward step. Simply open or expand the Metadata panel and you should see a button at the bottom of the panel called Transcribe. If you do not see the panel you can open it from the Window menu. The following panel allows you to transcribe as well as edit an existing transcription.

Premiere Metadata Panel
Premiere Metadata Panel

When you click the Transcribe button you will see the following dialog that allows you to choose the language, quality and whether to identify speakers.

Premiere Transcription Settings
Premiere Transcription Settings

The language choice is pretty straight forward. As for the quality I see no reason to ever choose anything other than high. When you choose identify speakers you will notice in the exported xml something like the following <Name>Speaker 1</Name>. I can see this being an interesting addition to an application but for this example I did not take advantage of this feature.

This process can take some time to complete.  Keep in mind that an accurate transcription relies on two very important criteria. First and foremost a good quality sound track is critically important. If you have background noise or a muffled speaker you will not get a very accurate transcription.  Second is the dictionary that is used to recognize words. In order to give you some context,  imagine attending a lecture where the speaker spoke in a language that you did not understand. A custom library is a library with specific word definitions that allow Premiere to more accurately identify and transcribe the spoken word. This is an area that you will see expanded on in future versions of the Production Premium Creative Suite.

When the transcription process is complete the xml that represents that transcription is stored as XMP Metadata as part of the video file.  It is possible to access and use XMP Metadata that is stored in a swf, flv and f4v via Actionscript but this should be carefully considered.  If you create a long format video that contains a great deal of speech to be transcribed that finished transcription can represent a fairly large increase in file size. As an example the following represents two files encoded with the same settings and length the larger file has metadata and the smaller does not.

file size with and with out metadata
file size with and with out metadata

Storing and accessing the transcription metadata stored in the final video file can also cause problems for streamed video from the Flash Media Server because of the way that text is stored in the video file.  I found the best way to use this transcription to create online searchable video was to export the xml file so that it did not remain part of the video file. This may be addressed in the future but for now if your video is longer than say 15 minutes and you plan to stream that video it would be best to export the xml that represents transcription to an xml file that is stored outside the video file.

I would suggest that you exclude the metadata for the final video that will be displayed online. In order to exclude metadata during export from Premiere Pro CS4 click the panel menu button panel_menu_button on the right hand side of the options panel in the export dialog box. In the popup deselect Include Source XMP Metadata.

Exclude Metadata
Exclude Metadata

One more slight wrinkle in the process is that you cannot export the transcription as xml from Premiere. The only way to export the transcription is from Soundbooth.

Editing The Transcription:

Anyone familiar with speech to text knows that it is not possible to get one hundred percent accuracy. With that said it is possible to get a high degree of accuracy given the criteria mentioned earlier in this article. There are a number of tools that can help you clean up the transcription in both Soundbooth and Premiere. Once the transcription process is complete and you see the text in Metadata panel you should see the play, loop and transcribe buttons. You should also see a search field at the to of the Metadata panel in both Soundbooth and Premiere. The search field allows you to search for words that are in the transcription. This functionality can prove very useful when you find a word that was not transcribed properly and may show up in multiple locations through out the transcription.  Once you find a word that needs to be corrected simply double click the word and you will be able to edit that word. Depending on how the word was recognized during the transcription process you may that you need additional functionality. If you right click on a word in the Metadata panel you will see the additional features.

Editing Transcription
Editing Transcription

Exporting The XML:

As I mentioned previously you cannot export the XML file required for this example from Premiere that must be done in Soundbooth.  Soundbooth has many fantastic features including volume correction and my favorite visual audio healing. You might wonder why I am mentioning Soundbooth features under the Exporting The XML heading; to refresh your memory it is because you cannot export the XML transcription from Premiere. If you have any last minute touch-ups for your audio track it might be a good idea to leave them to just before you export the transcription as xml. Then it is a simple matter to right click the audio track in Premiere and select Edit in Adobe Soundbooth and then Render and Replace.

Round Trip Editing From Premiere to Soundbooth
Round Trip Editing From Premiere to Soundbooth

From Soundbooth you will be able to clean up your audio, if required, and export the transcription as xml.  The changes that you make in Soundbooth will show up in Premiere as soon as you save thanks to Dynamic Link.  Once you are in Soundbooth you should see that the transcription has come over with the audio track. To export the xml file simply go to the File menu and then down to Export then select Speech Transcription.

Soundbooth Transcription Export
Soundbooth Transcription Export

Once the xml file is exported it is time to finish encoding your video into either an FLV or an F4V. If you have made changes to the audio in Soundbooth save and return to Premiere to finish encoding your video.  When considering the functionality required to create searchable video streaming vs progressive is an important consideration. Progressive video is video that is accessed by using the http protocol. Streaming video is accessed by using RTMP. For searchable video there are a couple of key differences that should help you choose the right technology. First navigation with in the video is key to the idea of searchable video. With progressive you would have to download all of the video from the start of the video to the place a user is navigating to in the video. If the video is fairly long this can be very frustrating for a user. You can imagine doing a search and finding the word you are looking for close to the end of say a forty minute video and having to wait for that amount of video to download before being able to jump to that portion of the video. Streaming on the other hand simply starts sending the video from the part of the video requested. Streaming makes searchable video usable for even long format video.  Another key feature of the Flash Media Server that assists in making searchable video a reality is something called enhanced seek.  The following is a definition from the online documentation:

Enhanced seeking is a Boolean flag in the Application.xml file. By default, this flag is set to false. When a play occurs, the server seeks to the closest video keyframe possible and starts from that keyframe. For example, if you want to play at time 15, and there are keyframes only at time 11 and time 17, seeking will start from time 17 instead of time 15. This is an approximate seeking method that works well with compressed streams.

If the flag is set to true, some compression is invoked on the server. Using the previous example, if the flag is set to true, the server creates a keyframe–based on the preexisting keyframe at time 11–for each keyframe from 11 through 15. Even though a keyframe does not exist at the seek time, the server generates a keyframe, which involves some processing time on the server.

The preceding should be fairly easy to understand how searchable video would benefit from this functionality but to make sure I will put this functionality in the context of this example. Imagine doing a number of searches on a long video. If the keyframes were not placed on every frame what you would notice is that some percentage of searches would take you past the point where the word was spoken in the video leaving you to wonder if the word was found at all.

The Final Step:

At this point you should have a video encoded as either an FLV or an F4V and an xml file that represents the transcription from the video file. In the second paragraph of this article there is a link to an example, the sample provided with this article has very close to the same functionality as that example. You can download the sample with the link provided at the bottom this article. Once you have downloaded those files and unpacked you should have the following files:


You should also have a skins folder. All of the files and the skins folder should be in the same directory on a web server or in the webroot in the Flash Media Server installation directory. The following is the typical path for the webroot folder when installed on Windows XP.

C:\Program Files\Adobe\Flash Media Server 3.5\webroot

This is of course required so that you can access the content from a web browser. The searchableVideo.html file is the html wrapper that hosts the swf. This is not required you can use your own html page to host the searchableVideo.swf. It is easy to add the searchableVideo.swf to your own html page from within Dreamweaver. Just add these files and the skins folder to your Dreamweaver site files and create a new page or open an existing page and simply drag the swf file (searchableVideo.swf) onto that page. Dreamweaver will create the object and embed code for you. Keep in mind that the searchableVideoPrefs.xml file needs to be in the same directory as the searchableVideo.swf on the web server. Organizing files for access over the web is much easier now with the Flash Media Server 3.5 because it has an embedded web server. You can simply drop the html and swf files that you would like someone to access using a web browser in to the webroot folder in the installation folder of the Flash Media Server. Once you have the files setup it is time to edit the searchableVideoPrefs.xml which allows you to specify the location of the transcription xml file and video. In addition you can also make changes to some of the player functionality and appearance from this same searchableVideoPrefs.xml file.

I would suggest that you open the searchableVideoPrefs.xml file in either Dreamweaver or an xml editor do not use a word processor. Once the file is open you should see the <sourceURI> tag. It is important that you do not edit any of the tags only the content between them. For instance make sure that when you are editing the <sourceURI> which represents the location of the video you do not change either <sourceURI> or </sourceURI> in anyway only the text between those tags. This is true for any tags in this file. If you wanted to play a video on a server with a dns name of and the video was in a Flash Media Server application called lectureVideos and the name of the video was chem101.flv the <sourceURI> tag should look like the following:


This may seem complex but it is really fairly simple. When you install the Flash Media Server on windows it has two pre-installed applications vod and live. These applications are represented as folders in the following location C:\Program Files\Adobe\Flash Media Server 3.5\applications. The name of the application is the name of the folder in that location. In the example that we mentioned you would have a folder called lectureVideo in the application directory mentioned above (e.g. C:\Program Files\Adobe\Flash Media Server 3.5\applications\lectureVideo). In side of that folder you will have a folder called streams and inside of that you will have a folder called _defInst_ and inside of that folder you will have your video file. So the entire path to your video file on the Flash Media Server would be C:\Program Files\Adobe\Flash Media Server 3.5\applications\lectureVideo\streams\_defInst_\chem101.flv. Remember that if you are using an f4v file that you must prefix the file name with mp4:. For instance if the previous example was an f4v not an flv the sourceURI tag would be the following:


As I mentioned previously there are many resources for learning about the different tools and servers used in this example.

Now you should have the hang of editing the searchableVideoPrefs.xml file. Next we are going to edit the location of the transcription xml file that was generated in Premiere and exported from Soundbooth. The same precaution holds true for editing this tag, do not change the tags in anyway only the contents. This location can either be relative to the swf or a complete http uri. For instance both of the following are correct:




In the first example it would mean that the RedWorkflow.xml (i.e. transcription xml file) would be in an assets folder which would be in the same folder as the searchableVideo.swf and searchableVideoPrefs.xml files. In the second example the RedWorkflow.xml file could be stored on the same or a different server and access by using the http protocol.

Lets take a look at how the finished example should look and label some of the areas of the example so that it is easier to follow along.

Seachable Video Player
Seachable Video Player

In the following image I have highlighted and labeled the important areas of the player so that it will be easier to understand my references:

Example with color overlay
Example with color overlay

The Text Cloud section represents the highest occurring words in the transcription. This allows the viewer to get an idea of the kind of content in the video. The viewer can click on any of the keywords in the Text Cloud in order to display those results in the Found Items section. The Relevant Text section is displayed when a viewer clicks an item in the Found Items section, it displays the text surrounding the found text. The Video Display shows the video as well as markers representing the found text. A viewer can rollover the marker to display the surrounding text as well as seek to that portion of the video. The Search Field allows a user to enter and search on one or more words and the Found Items section displays the result. It is also possible to sort the columns in the Found Items section by clicking the column headings.

There are a number of other settings in the searchableVideoPrefs.xml that you can use to change the functionality and appearance of the searchable video player. First minwordLength, use this to set the minimum word length for the text cloud at the bottom of the example. A setting of 5 will mean that no words shorter than 5 letters will show up in the word cloud. Next there is videoInitStartSeconds which determines the initial start time of the video when the player is first launched. There are a few other settings that will affect the appearance of the player and they are as follows:

globalTextColor : sets the color for ALL text on screen

swfBackgroundColor : sets the background color of the player

foundTextHighLightColor : changes the color of the text in the relevant text display

textBackGroundColor changes the background color for the text cloud and the relevant text area

Well that should get you started. If you have problems, interests or comments please leave them on this site so that I can respond.  There are many possible additions and changes that I can think of for this example. I am eagerly waiting to see and hear how people have used this example so please leave me a comment.

Download Searchable Video Player

Using the Flash Media Server Sample Video Play

For years the only way to play Streaming Video in Flash was to create your own video player in the Flash or Flex authoring software.  It was and is still not difficult if you were familiar with either of these applications as there are components for both environments that make it a fairly trivial task. With that said there are many people that are not familiar and do not have the time to get familiar with either of those applications but would still like to stream Flash video. Good news, there is a fully functional player that is installed with Flash Media Server 3.5 that is easy to configure and includes multi-bitrate support.

Inside the installation directory for the Flash Media Server you will find a “samples” directory and in that directory you will find a directory called “videoPlayer”. When you installed the Flash Media Server 3.5 you had an option to install Apache. You can confirm that your Flash Media Server installation is working simply by opening a browser on the same PC that has the Flash Media Server installation and browsing to http://localhost. When the page loads you should see the following image.

start screen
start screen

If the preceding page does not load it is most likely do to a conflict with another http server installed on the same PC. De install or turn off the other http server and browse to localhost, that should fix the problem. You may need to restart the PC for the changes to take effect. Once you know that the Flash Media Server installation is working correctly copy the “videoPlayer” directory to the webroot of the Flash Media Server installation directory which should resemble something like the following:

C:\Program Files\Adobe\Flash Media Server 3.5\webroot

Open the “videoplayer.html” file in a browser, scroll to the bottom of the page and select and copy the object and embed code in the white text box. Create a new blank html page and paste the object and embed code between the body tags of the new blank html page. The html with the object and embed tag (in blue) should look like the following:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”&gt;
<html xmlns=””&gt;
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
<object width=’640′ height=’377′ id=’videoPlayer’ name=’videoPlayer’ type=’application/x-shockwave-flash’ classid=’clsid:d27cdb6e-ae6d-11cf-96b8-444553540000′ >
<param name=’movie’ value=’swfs/videoPlayer.swf’ />
<param name=’quality’ value=’high’ />
<param name=’bgcolor’ value=’#000000′ />
<param name=’allowfullscreen’ value=’true’ />
<param name=’flashvars’ value= ‘&videoWidth=0&videoHeight=0&
<embed src=’swfs/videoPlayer.swf’ width=’640′ height=’377′ id=’videoPlayer’ quality=’high’ bgcolor=’#000000′ name=’videoPlayer’ allowfullscreen=’true’ pluginspage=’; flashvars=’&videoWidth=0&videoHeight=0&dsControl=manual&dsSensitivity=100&serverURL=rtmp:/vod/mp4:sample1_700kbps.f4v&DS_Status=true&streamType=vod&autoStart=true’ type=’application/x-shockwave-flash’> </embed>


Save the new html page in the same directory as the “videoplayer.html”.

C:\Program Files\Adobe\Flash Media Server 3.5\webroot\videoPlayer

Now we are going to edit the parameters that will allow you to use this player to play your own videos. The simplest way to play your own video using this player is to simply change the “serverURL” to reflect the location of the video you would like to stream. For instance the following example:


is referencing a video with the name “sample1_700kbps.f4v” in the following directory:

C:\Program Files\Adobe\Flash Media Server 3.5\applications\vod\media

When you stream MP4 or F4V files you need to add the prefix “mp4:” to the front of the file name. That is not the case with VP6. Do not forget that there are two “serverURL” parameters that you will need to change in the object and embed code (i.e. one for the object and one for the embed) so that the intended video plays in all browsers. Change the “serverURL” parameter to reflect the video that you would like to play. Just copy the video that you would like to play to the following directory:

C:\Program Files\Adobe\Flash Media Server 3.5\applications\vod\media

The name of the video that I am going to use for this example is “Redworkflow.f4v”. With that in mind the edited “serverURL” parameter should look like the following:


Since I am running everything off of the same PC I am using “localhost” for the server address. In a real environment you would substitute either the real server ip address or the dns name of the server for “localhost”. There is one additional change that you are going to want to make to the object and embed code and that is to change “dsControl” parameter from “manual” to “auto”. This setting allows the switching between streams to happen automatically.

When you run the html page in the browser the video should play. This example is simple and straight forward but will not provide for the best experience. Choosing a single video to stream ignores the fact that the internet and most networks will not provide a constant amount of bandwidth to most users. In other words you may start out playing video with out a problem only to find it skipping frames because someone on your network decided to download a large file at the same time that you were watching the video. The solution to this problem is “Dynamic Streaming“. Dyanamic Streaming adjusts to serve different quality streams based on the current capability of the viewer. The player that we have been using for this example supports “Dynamic Streaming” through the use of a smil file. You will notice that there is a file with the name “dynamicStream.smil” in the following directory.

C:\Program Files\Adobe\Flash Media Server 3.5\webroot\videoPlayer

That is the same directory where you saved the html page with the edited object and embed tag. Open the “dynamicStream.smil” in a text editor and you should see the following:

<meta base=”rtmp://localhost/vod/” />
<video src=”mp4:sample1_150kbps.f4v” system-bitrate=”150000″/>
<video src=”mp4:sample1_500kbps.f4v” system-bitrate=”500000″/>
<video src=”mp4:sample1_700kbps.f4v” system-bitrate=”700000″/>
<video src=”mp4:sample1_1000kbps.f4v” system-bitrate=”1000000″/>
<video src=”mp4:sample1_1500kbps.f4v” system-bitrate=”1500000″/>

In the preceding there are five files and bandwidth triggers (e.g.  bitrate=”xxxxxx”). For this example I am going to use only three to keep things simple. The files that I am going to use were encoded with the Adobe Media Encoder that is included with Creative Suite 4. They were encoded using On2 VP6 using a constant bitrate. The names of the files are:


Since these files are not F4V or MP4 files I will not need the “mp4:” prefix. The following is the edited version of the “dynamicStream.smil” file.

<meta base=”rtmp://localhost/vod/” />
<video src=”Redworkflow_300kbps.flv” system-bitrate=”300000″/>
<video src=”Redworkflow_400kbps.flv” system-bitrate=”400000″/>
<video src=”Redworkflow_500kbps.flv” system-bitrate=”500000″/>

You might have noticed that bitrate is in bits not kilobits. In other words 300000 is 300kbps (kilobits per second). Notice that I changed the bitrate attribute to reflect the data rate that the video file was encoded to using the “Adobe Media Encoder“.

The following is an example of what your finished project could look like using the sample Flash video player included with the installation of the Flash Media Server.

Example Using Sample Video Player
Example Using Sample Video Player

Well that should get you started. Drop me a line if you have success or problems.

<object width=’640′ height=’377′ id=’videoPlayer’ name=’videoPlayer’ type=’application/x-shockwave-flash’ classid=’clsid:d27cdb6e-ae6d-11cf-96b8-444553540000′ ><param name=’movie’ value=’swfs/videoPlayer.swf’ /> <param name=’quality’ value=’high’ /> <param name=’bgcolor’ value=’#000000′ /> <param name=’allowfullscreen’ value=’true’ /> <param name=’flashvars’ value= ‘&videoWidth=0&videoHeight=0&dsControl=manual&dsSensitivity=100&serverURL=&DS_Status=true&streamType=&autoStart=true’/><embed src=’swfs/videoPlayer.swf’ width=’640′ height=’377′ id=’videoPlayer’ quality=’high’ bgcolor=’#000000′ name=’videoPlayer’ allowfullscreen=’true’ pluginspage=’; flashvars=’&videoWidth=0&videoHeight=0&dsControl=manual&dsSensitivity=100&serverURL=&DS_Status=true&streamType=&autoStart=true’ type=’application/x-shockwave-flash’> </embed></object>

Flash Lite 3 and Flash Media Server Video

Examples Used in this article:

In this article I am going to cover two scenarios for streaming Flash video from the Flash Media Server to Flash Lite 3. The first is the simplest possible example the second will use script based bandwidth detection to determine the bandwidth available to the device and then stream the appropriate video based on that information.

Flash Lite 3 as has support for streaming content from Flash Media Server. I am sure that most of you already know that it cannot be the same support that is in the desktop Flash player and you would be right. There are several exceptions, for example you can stream content to a device with the FashLite 3.0 player but not from a device with the FlashLite 3 player to the Flash Media Server. I hope that one day soon we will be able to stream video from a cellphone to a Flash Media Server and broadcast to the world but for now we will have to settle for consuming that content on our FlashLite 3 enabled devices. The approach for creating a Flash Lite 3 application that receives streaming content from a Flash Media Server is very similar to creating that content and targeting the desktop player. I should also say that for now you cannot create FlashLite applications using Flex, I hope that changes soon but today the Flex component foot print is too large for devices. I will use Flash CS3 and Device Central for the examples in this article.

The example we are about to create should be familiar to you if you have created an application that took advantage of the Adobe Flash Media Server in the past. We will use NetConnection and NetStream to create the connection and video.attachVideo() and to attach and play the stream. Two notable exceptions to functionality as compared to the desktop Flash player are the lack of support for Remote SharedObjects and one-way streaming as I mentioned earlier. We are going to focus on video in this article, I will cover data in a separate article in the near future.

In order to test this example you will need to have Flash Media Interactive server 3 installed. If you do not already have it installed you can use the developer version which provides a connection limited development server. It is fully functional but will only allow a limited number of connections.

You can download this example (simpleStreamingExample.fla) and other examples from my Connect meeting room. When you download this example you will need to substitute your FMS servers name or ip address for the following in the actionscript of the simpleStreamingExample.fla file. If you have the FMS server installed locally that would be localhost or In addition you will need to substitute the name of a video file that you created and placed in the _definst_ directory under your FMS applications folder for the following melissaInterview in the actionscript of the simpleStreamingExample.fla file. You could also use one of the flv files on my Connect meeting room in the zip file called

The first part of the process will be to choose a target device. In other words what device or devices are we going to target with this application? Launch Device Central and sort the list by the version of FlashLite then choose 3.0. You should see a few devices in the list, if you don’t make sure to download the newest device profile update #5. For this example I am going to use a generic Flash Lite 3 (240 x 320) profile because there is a problem with the new Nokia N95 8GB profile and DoCoMo removed support for video from the 905i series. The issue with the Nokia N95 8GB profile is a known issue and should be fixed shortly and DoCoMo will add video support to the 906i series. Before you wonder why I asked you to download the update, I just wanted to see if I could get you to do it. Just kidding there will be other updates and I want you to get in the habit so that you always have the latest intel on devices that support Flash. Now that you have a new blank Flash file open in Flash CS3 we will move on to the next major step which is to create the video object that we will use to attach our streaming video. Open the Flash library from the Windows menu in Flash CS3 or you can use the short cut keys (cntrl & L). From the Display panel menu options of the library panel select “New Video…”.

Create The Video Object

Give the video object a name (“vid”) and drag it to the stage. Once it is on the stage you will need to give it an instance name. Simply click on the video object that you moved to the stage then look at the property inspector at the bottom of the stage.

Flash CS3 Property Inspector

The instance name is “vid_video”. We will use this name in the Actionscript to attach the video stream to this object. Now its time for a little Actionscript. This is a very simple example and in order to keep it simple I am going to place my Actionscript on the first frame of a layer that I named “AS”.

I am using an “if(inited” code block as the starting point of my application. Inside of this “if” statement I am setting up a connection to my Flash Media server using the “connect” method of the NetConnection Class.

if (inited == null) {
inited = true;

nc = new NetConnection();


function playvid(){

ns = new NetStream(nc);


The parameter in “nc.connect(“rtmp://localhost/simpleVideo/”)” points to the application on the FMS server. “RTMP” is the protocol used to carry the content. There are several types of RTMP but Flash Lite 3 only supports basic RTMP no tunneling or encryption.



RTMP Real-Time Messaging Protocol
RTMPT Real-Time Messaging Protocol tunneled over HTTP
RTMPE 128-bit encrypted Real-Time Messaging Protocol
RTMPTE 128-bit encrypted Real-Time Messaging Protocol tunnelled over HTTP
RTMPS Real-Time Messaging Protocol over SSL

The default port for FMS is 1935, that can be changed if you use the default you do not have to include the port in the server reference. Finally the application name (i.e. simpleVideo), simply means that there is a folder in the applications folder inside the installation folder of the Flash Media Server called simpleVideo.

C:\Program Files\Adobe\Flash Media Server 3\applications\simpleVideo
FMS Folder Structure

Using a reference to the connection created in the previous step we create a one way channel inside the connection using NetStream.

ns = new NetStream(nc);

Using the reference from the previous step we attach the stream to the video object on stage.


Finally we start to play the video. Notice that we leave off the “.flv” file extension.“melissaInterview”);

Pretty simple huh?

Now lets add a little control to this example. I would assume that most people viewing video might want to pause and play that video. I am going to create a function called “pausePlayVid()” and inside of that function I am going to add the pause method of the Netstream class.

function pausePlayVid(){



To keep it simple I am going to use a component that I created to map navigation keys to function names. In other words I would assume that your device has left,right,up and down navigation keys, this component allows you to pick one of those navigation keys, in this case I will use the right navigation key, and map that to the function we just added to the example called “pausePlayVid”. This is a simple component that you can download with the samples for this article. Now when I test this example in Device Central and the video starts to play if we hit the right navigation key it will pause and if we hit it again it will play.

There is one more thing we should consider if we want this to work on mobile phones, bandwidth! I am sure you have noticed that you can have a conversation with someone on your cellphone and simply turn around and loose the connection? If you haven’t then you must live in cell tower heaven. For all the rest of us we should consider a way to stream different content based on available bandwidth. There is nothing we can do for a lost connection although that would be a neat trick. At this point I was planning to show how we could use the native bandwidth detection of FMS 3(Flash Media Server) to automatically select the best streaming content for the current bandwidth of the FlashLite enabled device but unfortunately there is a problem that will not allow this functionality to be used with Flash Lite 3.x.

I am still looking into the cause of this but all is not lost. Even though we cannot use the native bandwidth detection we can use an approach developed back in the days of Flash Communication Server (i.e. predecessor to FMS) and described by Stefan Richter on Adobe’s Developer Connection.

This is a very good article that covers in detail the approach for bandwidth detection that will work with FlashLite 3 content. In this article you will also find tutorial files and the server side script that performs the bandwidth detection. The approach involves a call from the client to a server side script. The server side script calls a method on the client to determine the devices bandwidth and sends the value back to the device. At this point the device can use this information to choose the most appropriate content. You will need to download the server side script (bwcheck.asc) and place it in a folder called “bwcheck” under the applications directory of the Flash Media Server 3 installation directory.

For all those not familiar with the Flash Media Server, the “.asc” extension denotes this as a server side script.

Now lets take a look at an example (bwcheckExample.fla) that uses bandwidth detection to determine the appropriate video to play on the device. You can download this example and other examples from my Connect meeting room. When you download this example you will need to substitute your FMS servers name or ip address for the following in the actionscript of the bwcheckExample file. The video files for this example are in the archive. Unzip the video files and place them in the _definst_ directory inside the streams folder of the Flash Media Server as the following screen capture illustrates.

directory for videos on FMS server

There is a brief description of the approach in the help files for Flash Media Server. Even though the description mentions “native bandwidth detection” the actionscript will work for script based detection as well with one exception. You will need to set the following to false in the “Application.xml” file on your Flash Media Server.

<BandwidthDetection enabled=”true”>

In the following example we will use two connections to the server. The first is a connection to get the available bandwidth and the second is to connect and play the appropriate stream. Just to be clear I had to create the different video files (“.flv”) manually. There are server solutions to realtime transcoding but they are either too expensive or outside the scope of this article to explain, that maybe a topic for a future article. It is also worth noting that in this example we only check the bandwidth once, it would be a good idea to check the bandwidth again in the event of an error or possibly poor video play back performance. That might also be the topic of a future article as well. As I have already covered the basics I will only cover the bandwidth detection in this example. The following example starts the same way the previous example started with a new NetConnection(). When the connection is made and accepted by the server side script (“bwcheck.asc“) the process of detecting the bandwidth begins. The server calls the method “onBWCheck” and sends packets of data in order to determine the clients bandwidth. When the process is complete the server sends the results to “onBWDone”.

We create the connection that will be used to check the bandwidth of the client.
nc = new NetConnection();

On the server the following code in the bwcheck.asc file on the FMS server accepts the connection and kicks off the detection process by calling the function calculateClientBw inside the same file.

application.onConnect = function(p_client, p_autoSenseBW){
if (p_autoSenseBW)

The following is method on the client is called by the server to assist in determining the bandwidth of the client.

nc.onBWCheck = function() {
return ++counter;

When the process is complete the server calls the client with the following and passes in the bandwidth, deltaDown, deltaTime and latency.“onBWDone”);

On the client the following method retrieves the bandwidth, deltaDown, deltaTime and latency and then calls the function on the client that will determine the appropriate video file to use.

nc.onBWDone = function(p_bw, deltaDown, deltaTime, latency) {

The following function uses the bandwidth information passed to it to set a variable called useVideo to the appropriate video file. For simplicity I named the video files for the bandwidth they will use (e.g. 200kbps). In addition I am also changing the amount of video that will be buffered before playing each video.

function playVideo(param_detected_bw:Number) {
var detected_bw:Number = param_detected_bw;
if (detected_bw>200) {
bdwdth_txt.text = “connected @ “+detected_bw +”kbps playing 256kbps_Stream”;
useVideo = “200kbps”;
bufferlength = 4;
} else if (detected_bw<200 && detected_bw>=160) {
bdwdth_txt.text = “connected @ “+detected_bw +”kbps playing 150kbps_Stream”;
useVideo = “150kbps”;
bufferlength = 7;
} else if (detected_bw<160 && detected_bw>=120) {
bdwdth_txt.text = “connected @ “+detected_bw +”kbps playing 100kbps_Stream”;
useVideo = “100kbps”;
bufferlength = 9;
} else if (detected_bw<120 && detected_bw>=85) {
bdwdth_txt.text = “connected @ “+detected_bw +”kbps playing 75kbps_Stream”;
useVideo = “75kbps”;
bufferlength = 10;
} else if (detected_bw<85 && detected_bw>=65) {
bdwdth_txt.text = “connected @ “+detected_bw +”kbps playing 50kbps_Stream”;
useVideo = “50kbps”;
bufferlength = 12;
} else {
bdwdth_txt.text = “bandwidth too low. Sorry”

Well thats it. I hope that helps get you started creating streaming Flash video content for Flash Lite 3.x. The following articles will help you round out your understanding of Flash video support in Flash Lite 3.

Flash Lite 3 video capabilities

How to play FLV video from YouTube using Flash Lite 3

I hope you found this article useful.