Streaming Video with Flash Media Live Encoder

April 19, 2010

Last month I wrote about streaming video to a media server via flash. I wrote a script that published to a flash media server and another script to play the stream off the server. This solution proved clunky since I was unable to set the quality settings correctly.

Late last week I had another meeting about commencement and a woman in Athletics, who streams basketball and football games over their server volunteered to help stream commencement. The process is very much the same as before, multiple cameras feed into a switcher and then publishes to a server in Kansas City. In the secondary location, we pull the video feed off of the internet and project it onto a screen.

What no one knew was what was happening on that server. So I went back to our media server and explored; here is the solution I came up with:

Adobe Flash Media Live Encoder

I found Adobe’s Flash Media Live Encoder off of Adobe’s website and noticed in its configuration there was an option to publish to a streaming server. Within the program I can set how many Kbps per second, format, frame rate and input size; exactly what I was looking for. The following are the steps I used to publish to our server. For security reasons, the server name has been removed.

Set up an Application on the Media Server

This is as easy as creating an empty folder on the streaming server. Mine is called “multicomputers”. Why did I call it that? It was an existing temp project and I didn’t want to create a new folder.

Adobe Flash Media Live Encoder Settings

Below are the important settings that I used to connect the laptop with my camera and to the streaming server.

Video:

Setting Value Comments:
Device Microsoft DV Camera and VCR This is a Canon HV30 video camera that is connected via firewire. In the settings for the camera I had to output the video as DV (not HDV). This limits it to 720×480 but was the only setting I could get to work.
Format VP6 I have Flash Media Server 2.5, which can only stream VP6. If you have FMS3 or FMS3.5 then you can choose H.264 which will give you a higher quality with less bandwidth (Bit Rate).
Input Size 720×480 This was the highest setting I could get with DV.
Bit Rate 1800Kbps at 720×480 1800Kbps looked good when projected on a projector. To compare, our normal videos that sit on the server stream out at around 450Kbps.
Deinterlace Checked Always deinterlace web video.
Timecode Checked If this isn’t checked, the flash player that reads the stream will create an error.

Audio:

Setting Value Comments:
Device IDT Audio IDT is the computer’s internal sound card. You can change this to the DV camera as well.
Format MP3 FMS <3 MP3s
Bit Rate 128Kbps

Stream to Flash Media Server:

Setting Value Comments:
FMS URL URL to the application on the server
Stream livestream The name of the stream. You can have multiple streams in one application.

Stream:

Hit the “connect” button to test your media server connection. Once connected, hit the “Start” button and the video will stream to the server.

Watching off the Media Server:

package {

import flash.display.Sprite;

import flash.events.*;

import flash.media.Camera;

import flash.media.Video;

import flash.net.NetStream;

import flash.net.NetConnection;

public class ViewOnly extends Sprite{

var nc:NetConnection = new NetConnection;

var video:Video;

var customClient:Object = new Object();

public function ViewOnly(){

video = new Video(720, 480);

addChild(video);

nc.objectEncoding = 0;

nc.connect(“rtmp://server/multicomputers”);

nc.addEventListener(“netStatus”, onNCStatus);

}

private function onNCStatus(event:NetStatusEvent):void {

if(event.info.code==”NetConnection.Connect.Success”){

var ns2 = new NetStream(nc);

ns2.client = customClient;

ns2.play(“livestream“); //this is the stream name from above

video.attachNetStream(ns2);

}

}

}

}

Tags: , , ,

Comments are closed.