Flash Media Server to Adobe Connect

August 22, 2011

In this article I will describe how to use a recently created custom pod for Adobe Connect. This custom pod is provided free of change and is provided as is with no additional support or warranty (how is that for some lawyer speak). Briefly, this custom pod allows you to stream high frame rate video from the Adobe Flash Media Server to an Adobe Connect meeting room. I used the collaboration sdk to create a shared experience. In other words if you are a host in a meeting room you can load and setup a connection to both live and ondemand video that you control for the meeting participants. As the host you make the connection and choose the video and when you hit play all participants will see that the video has started to play. This is very different than a typical video player where each individual has their own experience and could be watching different sections of a the same or different videos. This custom pod understands the different Adobe Connect meeting roles (i.e. host, presenter, participant). Only the host has interface elements (buttons, progressbar, etc…). Admittedly  the user interface could use some work and I do intend to improve it so do not beat me up too bad but also do not hesitate to give me advice on improvements.

The following is a simple diagram of the workflow.

Live Video Workflow for Custom Pod

A) Flash Media Encoder B) Flash Media Server C) Custom Pod in Connect Meeting

There are many considerations when ever you consider streaming high quality video. First of all the camera is an important part of the equation. I did a number of tests with web cameras and found that two of the three web cameras that I tested could not consistently produce 30 frames per second of video. Do not skimp on a quality camera. The second, third and fourth and and and considerations are all BANDWIDTH. You cannot stream a 500 kbps stream over a connection that only has 300 kbps available. There are many people that are confused about bandwidth but it is fairly simple. If you look at the diagram above you will notice that you have to send the encoded stream from the camera / laptop to the Flash Media Server and then on to Adobe Connect. You need the appropriate amount of bandwidth at each step. It is not enough to have a great connection from FMS (Flash Media Server) to Adobe Connect you also need an appropriate connection from the source (camera / laptop) to FMS. Often someone assumes that because their wireless card mentioned 54 Mbps that they are covered for streaming video. The key consideration is “usable bandwidth”. I have included the ability to test bandwidth in this application as well as a status indicator that will give you an idea if your connection is appropriate for the video you are attempting to stream.  It is also important to note that available bandwidth changes continuously.  You might find that you do a bandwidth test and have plenty and thirty seconds later you have half as much. It is best not to use a wireless connection as their is more variability and more unknowns with a wireless connection versus a wired connection.

Custom Pod UI:

Lets walk through some of the functionality of the custom pod.  After it is uploaded to a share pod inside of Adobe Connect it should look like the following:

Adobe Connect Custom Video Pod

Adobe Connect Custom Video Pod

The first thing you should understand is that this is the interface that the host will see when they upload the custom pod. The dark green in the progress bar shows the progress of the playing video. The dark blue shows the size of the current buffer. If you do not see any dark blue then there is no buffer and you are probably not having a great play back experience. You will not see a progress bar for live video as there is not enough buffer to show. Notice the green status indicator in the upper left hand corner of the screen.  This indicator will be seen by both hosts presenters and participants. This indicator shows only the local connection status. In other words if you are looking at this indicator it shows your status not a combined or status of other individuals in the meeting. The following table gives a brief highlight of the states and meanings.

  This indicates no connection. Each time you connect the indicator will turn green initially and each time you disconnect it will turn black.
  This indicates the initial connection as well as a video that has enough bandwidth to play and keep up with the video that is being sent from the Flash Media Server.
  This indicates that there are or have been issues with the video playback. Often times this is represents a temporary condition so do not panic the first time you see the indicator turn orange or red.
  This indicates that the issues are getting worse but as stated before this can be temporary so give it at least a few seconds and see if the condition improves.

If someone in the meeting mentions that the video playback is not smooth or the quality is not great you could ask them what the color of the indicator is to get an idea if the problem is bandwidth related. This indicator does not indicate a change in frames per second. It is possible to retrieve fps data from the metadata of the stream but it seems that this does not indicate that actual fps on the passed on from the encoder (e.g. Flash Media Live Encoder).

Adobe Connect Meeting Host:

You will notice that each role in an Adobe Connect meeting has a slightly different view of this custom pod. The host has complete control. As a mater of fact the first host to upload the custom pod retains complete control and all other hosts will see the controls but will only be controlling their local experience. With that said I think that it is a good practice to have only a single host in most if not all meetings. More than one presenter is not an issue but more that one host can create issues regardless if you are using this custom pod or not.  The following is the host view of the custom pod:

Custom Pod with Settings Visible

Custom Pod with Settings Visible

Workflow for live video:

The first step to playing live video is to have a live video source. Keep in mind that if you intend to use a simple web camera your quality will probably not be that much better than what you would get out of the default camera support in Adobe Connect. If on the other hand you have a higher quality camera or would like a higher frame rate follow these steps.

1) setup a computer with enough horse power to encode the video and with enough bandwidth to send that video to the Flash Media Server. Download and install the free Flash Media Live Encoder.

2) setup or use an existing Flash Media Server. There are a great number of resources for getting started with the Flash Media Server.

3) upload the custom pod. The custom pod is in a zip archive. In a share pod in Adobe Connect simply locate the custom pod zip archive on your computer and upload the entire zip.

4) enter the server url and stream name for the video that you are publishing from the Flash Media Live Encoder. It is a simple matter to find the connection stream for the server. You will notice by the example above the entry field that it starts with rtmp. This is the realtime message protocol used by FMS. The next element in the connection stream is the server ip address or dns name. After the slash following the server name or ip address is the application name. This may seem a little strange but this represents a folder name inside the application folder inside the installation folder of the Flash Media Server. Once you have the Flash Media Server installed find the installation folder and open it and inside you will find the application folder. Inside of the application folder you will find a vod and live directory. These are the default applications. If we analyze the following connection url, rtmp is the protocol, the ip address is the address of the Flash Media Server and vod represents the default directory for ondemand streams (i.e. files) inside the application directory.

rtmp://192.168.0.2/vod

The stream name is what ever the file name is for ondemand or what ever name you entered into the Flash Media Live Encoder.

Flash Media Encoder Output Panel

Flash Media Encoder Output Panel

After the all the elements of the workflow are in place it is time to turn on the camera and stream the video from Flash Media Live Encoder to FMS. This is a pretty straight forward task, simply hit the start button in Flash Media Live Encoder.

Once the live video is streaming to Flash Media Server it is time to connect to and play the live stream into the custom pod inside of Adobe Connect.

Custom Pod Settings Panel

Custom Pod Settings Panel

This is the settings panel for the Custom Pod that you will use in the Adobe Connect Meeting room. It allows you to setup and make a connection to the Flash Media Server. It also allows you to choose between ondemand and live streams and test your bandwidth. Notice that the stream name is the same as the the stream field in the Flash Media Live Encoder. If these do not match you will not see video in the custom pod. Also notice that if you want to view live video you must select the Live Stream check box.

Well I think that about covers it. I will post the link to down load the custom pod later today along with a few other links that might be helpful. Please drop me a comment to let me know if it is working or not and any improvements that you would like to see.

I put together a short overview presentation of the custom pod functionality and setup. If you would like to jump right to the link that allows you to register for download it is on slide eight. Please let me know what you think. Note: If you are having trouble with the registration page clear the cache on your browser and reload the page.


Passing Variables Into Flash using the Querystring

June 7, 2010

I decided the write this post because I have been getting numerous requests for using a simple media player (Flash) with a dynamic html page. In other words people would like to have a list of videos in html as links and when you click the link the video reference is passed into the media player (Flash) and plays the video. There are a number of ways to accomplish this task but for this example I am going to show how you can have one page pass variables to a second page via the querystring, the second page picks up the variables using swfobject and passes them into the media player.

The example files are setup so that the home.html page has the link with the name value pairs (querystring). When you run the home.html page in a browser and click the link the player.html page with load. If you look at the location field of your browser you should see something like the following:

http://localhost/passingVars/player.html?videourl=rtmp://localhost/vod/sample.flv&videocaption=just%20a%20bit%20of%20text

First notice that this is running on an http server (e.g. http://localhost). Second notice that there is a ? after player.html, the next section contains two name /  value pairs. The first starts with videourl (is the variable) then rtmp://localhost/vod/sample.flv (is the value). Next you will notice a & symbol this is the beginning of the second name / value pair. Finally videocaption is the second variable and just%20a%20bit%20of%20text is the value of that variable. The value is url encoded.

In player.html there is some javascript that picks up the variables and values from the query string and passes them into the Flash file (final.swf). The following captures both the variable name and the value:

if (swfobject.getQueryParamValue(“videourl”)) { flashvars.videourl = swfobject.getQueryParamValue(“videourl”); }


if (swfobject.getQueryParamValue(“videocaption”)) { flashvars.videocaption = swfobject.getQueryParamValue(“videocaption”)

The preceding also adds the variable names and values to to the flashvars object which makes them available to the Flash file. In the Flash file I am able to retrieve the values using the following actionscript:

var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

if(paramObj.videourl){
msg_txt.appendText(“\t” + “videourl : “+ paramObj.videourl + “\n”);
msg_txt.appendText(“\t” + “videocaption : “+ paramObj.videocaption + “\n”);

Then it is a simple matter to pass the value for the video uri to the FlvPlayback component. You can find and download the example here. The Flash source file is in the assets folder (final.fla). This file will require Flash CS5.


Choice!

May 18, 2010

Freedom of choice


CS5 Magic

April 11, 2010

If you have not heard or you have nothing to do with content creation on the web you can disregard this post. On the other hand if you have anything to do with content creation on the web no matter if you are a designer or a developer you are going to want to pay attention to this release.


iWhat? Check this slate out!

March 19, 2010

It is faster with a larger screen,  plays Flash content and has upgradeable memory to name a few of the advantages over its competition. No this is not a cartoon character  it is the Neofonie WePad. Never heard of them, me either but it looks like they could be a contender! Check out the specs at the bottom of the pdf located at the preceding link.


Common Sense Approach to Apple Rhetoric

March 10, 2010

All to often marketing rhetoric is mistaken for technical reality. One one hand we hear Steve Jobs tell the world that Flash does not work well on their devices and with the other hand he is making sure that it does not by denying Flash access to the ability that they retain for only their applications and technology. It is becoming more and more difficult to make these claims as the Open Screen Project is beginning to have an effect. We are starting to see the results of this effort in devices such as the up coming HP Slate. In addition there are a few people that have taken up the gauntlet and did a little research to better understand the issue. I hope you take a look but if you do not an article by Dan Rayburn summarizes the results very well:

“When it comes to efficient video playback, the ability to access hardware acceleration is the single most important factor in the overall CPU load. On Windows, where Flash can access hardware acceleration, the CPU requirements drop to negligible levels.

Overall, it’s inaccurate to conclude that Flash is inherently inefficient. Rather, Flash is efficient on platforms where it can access hardware acceleration and less efficient where it can’t. With Flash Player 10.1, Flash has the opportunity for a true leap in video playback performance on all platforms that enable hardware acceleration.

Apple complaining about Flash being a CPU Hog while not exposing “the appropriate hooks” to enable Adobe to access hardware acceleration seems disingenuous at best.”

Thanks to Dan Rayburn for the lucid approach to this political topic!


Securing Flash Media Interactive Edition

March 8, 2010

A critical component to rich media is securing your content and resources. In this article I am going to cover how to restrict someone with the Flash Media Live Encoder or for that matter any encoder from publishing to the Flash Media Interactive Server. In the process I am going to show you how to allow someone with the appropriate permissions and the Flash Media Live Encoder to publish to the server.

There are many ways to accomplish this goal. First there are Adobe partners that have written plugins for the Flash Media Server that allow you to restrict access to the server through the use of these plugins.

There are also server side APIs that allow you to connect with other systems and data. For instance you can use the WebService class to create and access a WSDL/SOAP web service or the XML class lets you load, parse, send, build, and manipulate XML.

In this short example I am going to use a server side event “onPublish” to retrieve the querystring and respond to a request to publish a live stream from the Flash Media Live Encoder to the Flash Media Interactive Server. Now there is a reason that I am calling out the Flash Media Interactive Edition and not the Streaming Edition and that is that the Streaming Edition does not support server side scripting.

Server side scripts are written and stored in “.asc” files in an application directory inside the application folder on your Flash Media Server. As an example if I had a application called foo I would store my server side script (e.g. main.asc)  in the following location.

server side script location

There are a number of events that you can work with on the server side; for instance onAppStart, onConnect, onPublish. You can find information about these and other events, methods and properties in the documentation.

Lets take a look at the final server side script in the main.asc file.

application.onAppStart=function(){
trace(“***** on App Start”);
}

application.onConnect=function(clientObj){
trace(“**** on connect”);
this.acceptConnection(clientObj);
return true;
}

application.onPublish = function(clientObj, streamObj){
logon = extractQueryString(streamObj.publishQueryString, “logon“);
if(logon != “fmle”){
application.disconnect(clientObj);
trace(“Sorry you aint publishing”);
}

}
function extractQueryString(queryString, arg){
var returnValue = “”;
temp = arg + “=”;
i = queryString.indexOf(temp);
if (i != 0){
temp = “&” + arg + “=”;
i = queryString.indexOf(temp);
}
if (i != -1){
returnValue = queryString.substr(i+temp.length);
i = returnValue.indexOf(“&”);
returnValue = returnValue.substr(0, i);
}
return returnValue;
}

In the preceding code the events are in bold. The helper function that will extract the search term (i.e. the second parameter that we pass in to the extractQueryString function called arg)  that we tell it from the querystring is green. The bit that disconnects an in appropriate publisher is red.

First let me say that this is a very simple example that should be coupled with functionality that does more to integrate with existing systems (e.g. ldap) but after many calls from customers concerned that someone might be able to publish inappropriate content or use their bandwidth I thought I would at least get the ball rolling. The part of the script in red is a great place to look at integrating with other systems. Notice that in the if statement that I am simply looking for the string “fmle” this should really be a more robust solution but it will work for this simple example.

In the preceding code onAppStart does just that it fires when the application starts. The onConnect fires when a client connects to this application. Finally onPublish fires when someone tries to publish a stream to the server.

There are two parameters the first is the client object that represents the client publishing the stream to the server. The second is a reference to the stream that the client is attempting to publish. Even though I am not going to cover it in this article it is worth mentioning that you can use the stream reference to publish a stream from one server to another in the event that you want to propagate a stream across a number of servers.

What will happen when someone tries to publish a stream to an application that has this “main.asc” in the application folder? If they do not add “logon=fmle” to the connection they will be disconnected (see script in red above).  Most people do not want to stop all Flash Media Live Encoders from publishing to their server they just want to make sure that the right users can publish to their server. In this example the way that we do that is to make sure that who ever attempts to publish to the server includes “fmle” in the querystring. This has to happen from the Flash Media Live Encoder or for that matter any encoder that you are using to publish to the server. In this example I am going to use the Flash Media Live Encoder.  The following is a screen shot of the Flash Media Live Encoder’s output panel:

Flash Media Live Encoder Output Panel

Flash Media Live Encoder Output Panel

Substitute your server dns name or ip address for localhost in the preceding screenshot. There are two elements that you need to be aware of in the preceding. First notice that “foo” is after the last forward slash “foo” represents the  application name which is the same as the name of the directory where “main.asc” is located (see first screenshot). Second notice that after the stream name there is the following “?logon=fmle” this is the querystring. This querystring is initially extracted by using publishQueryString property of the stream object (see blue script above). This represents the entire querystring which often includes other parameters. Since we are only interested in the “logon” parameter we pass the querystring to extractQueryString(see green script above). This function parses the query string and returns the term and value of the term we pass into the extractQueryString function (the term that we are passing in is logon and is the second argument in the following script:

logon = extractQueryString(streamObj.publishQueryString, “logon“);

The value of this argument will have to be “fmle” or the attempt to publish will be denied.

That should cover it. If you have questions or comments let me know. I will most likely follow this up with short article about swf verification.


Sense and Sensibility about Flash and the iPhone

March 5, 2010

I have to say that I have seen and heard just about every kind of response possible regarding Flash support on the iPhone.  I had friends call that work for Apple and ask why Adobe could not get Flash to work on the iPhone. I have had people tell me over and over from within Adobe that it was coming any day now. The reality is that there is only one reason that there is no Flash support on the iPhone, I will give you a hint, it has nothing to do with technology.

The good news is that I am not alone and that there are number of posts and blogs that are echoing my feelings about this issue.


Online Searchable Video

October 15, 2009

Overview:

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.

Requirements:

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:

searchableVideo.html
searchableVideo.swf
searchableVideoPrefs.xml

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 foo.com 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:

<sourceURI>rtmp://foo.com/lectureVideo/chem101.flv</sourceURI>

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:

<sourceURI>rtmp://foo.com/lectureVideo/mp4:chem101.f4v</sourceURI>

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:

<transcriptLocation>assets/RedWorkflow.xml
</transcriptLocation>

and

<transcriptLocation>http://foo.com/searchableVideo/assets/RedWorkflow.xml
</transcriptLocation>

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

July 23, 2009

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” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
</head>
<body>
<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=rtmp:/vod/mp4:sample1_700kbps.f4v&DS_Status=true&streamType=vod&autoStart=true’/>
<embed src=’swfs/videoPlayer.swf’ width=’640′ height=’377′ id=’videoPlayer’ quality=’high’ bgcolor=’#000000′ name=’videoPlayer’ allowfullscreen=’true’ pluginspage=’http://www.adobe.com/go/getflashplayer&#8217; 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>
</object>

</body>
</html>

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:

serverURL=rtmp://localhost/vod/mp4:sample1_700kbps.f4v

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:

serverURL=rtmp://localhost/vod/mp4:Redworkflow.f4v

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:

<smil>
<head>
<meta base=”rtmp://localhost/vod/” />
</head>
<body>
<switch>
<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″/>
</switch>
</body>
</smil>

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:

Redworkflow_300kbps.flv
Redworkflow_400kbps.flv
Redworkflow_500kbps.flv

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.

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

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=’http://www.adobe.com/go/getflashplayer&#8217; flashvars=’&videoWidth=0&videoHeight=0&dsControl=manual&dsSensitivity=100&serverURL=&DS_Status=true&streamType=&autoStart=true’ type=’application/x-shockwave-flash’> </embed></object>

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: