The Flash Video platform supports live video encoding and delivery when used with Flash Communication Server MX. Macromedia Flash Player (6 or greater) contains an audio and video encoder that lets you capture audio and video directly from any camera or microphone that is connected to your computer. While capture cards and other live video-encoding hardware should improve live video quality by pushing a better video signal into Flash Player and by handling much of the processing through the hardware, you don't necessarily need them to achieve basic live video streaming.
The Flash Player video encoder supports live video, audio push, record, and record-append. This support lets you build Flash-based live video streaming, video chat, video messaging, webcasting, video conferencing, and stop-motion capture. You can also use the prebuilt Flash components to assemble your live video conference quickly or to create a video recorder using Flash Player.
Another option for hosting live video is Flash Video Streaming Service (FVSS).FVSS (www.macromedia.com/go/fvss) is a hosted solution built with Macromedia Flash Communication Server MX and industry-leading content delivery network partners. FVSS provides video on demand and live streaming. If you've spent considerable effort making sure your video is of the best possible quality, then you want to make sure the end result is a great experience for your audience. FVSS takes care of all the network hassles, including failover and redundancy, and is managed by industry experts who know how to stream Flash Video better then anyone else on the planet.
To complete this tutorial you will need to install the following software and files:
Pertains to all skill levels, basic to advanced.
Before reading this article, check out these other great Flash Video resources:
Also check out my other article on Flash Video, Best Practices for Encoding Flash Video.
In the Frame Rate, Size, Keyframes, and Data Rate section of my other article, "Best Practices for Encoding Flash Video," you were introduced to determining the bits per second of a clip by multiplying the frame height and width and the rate:
Formula: frame height x frame width x frame rate (fps) = total bits/sec. Example: 320 x 240 x 30 fps = 2.3 Mbps
However, when you use Flash for live video encoding, bandwidth is set in bytes per second (Bps), not kilobits per second (Kbps). To determine the bandwidth settings for the video encoder, you must divide the total bits by eight (eight bits equal one byte). Use the following formula to determine bytes per second:
Determine bytes per second bandwidth: ((320 x 240 x 30fps)/8) = 288,000 Bps
To determine your bandwidth limits, convert the number from bytes per second (Bps) to kilobits per second (Kbps) with the following formula:
Convert Bps to Kbps: (Bps x 8) DIV 1000 = Kbps Therefore: 288,000 Bps = 2,304 Kbps or 2.3 Mbps
The following matrix demonstrates the data rate formula to determine the setting values for the Camera object in Flash. You can see the live samples in the embedded player below the matrix.
| Camera.setMode (w,h,fps) |
setKeyFrame Interval (kfi) |
Camera.setQuality (b,q) |
Microphone. setRate (sr) |
||||
|---|---|---|---|---|---|---|---|
| w | h | fps | kfi | b | q | sr | |
| Width | Height | FPS | KFI | Bandwidth (bytes/s) | Quality | TOTAL Data Rate (Kbps) | |
| > 1Mbps High Broadband | |||||||
| 320 | 240 | 15 | 60 | 144,000 | 85 | 22 | 1,196 |
| 786 kbps Broadband | |||||||
| 240 | 180 | 12 | 48 | 64,800 | 85 | 22 | 562 |
| 384 Kbps Broadband | |||||||
| 192 | 144 | 7 | 28 | 24,192 | 85 | 11 | 216 |
| 56 Kbps Dial-Up | |||||||
| 80 | 60 | 8 | 32 | 4,800 | 85 | 8 | 54 |
To view this content, JavaScript must be enabled, and you need the latest version of the Macromedia Flash Player.
Download the free Flash Player now!
To determine the recommended live encoder settings for Flash Player, I studied a variety of settings. I built a simple application in Flash to record a series of 30-second clips, monitor the stream progress, and determine the best quality settings for a variety of bandwidths (see Figure 3). The study application let us set the video encoder settings and start a 30-second test.
Figure 1. The live testing tool lets you enter camera-setting values and see the results. Connect your camera or video source and try it out below.
Note: To use the Live Settings Tester, you must have Flash Communication Server installed on your local machine and a folder within it called videoStudy. Full installation instructions are included in the sample file ZIP below:
Figure 2 shows a snapshot of Flash Communication Server during one of the studies. Notice that two streams were consumed: one for the incoming stream and one for the playback stream. Also notice how the bandwidth is consumed. Flash Communication Server calculates bandwidth as total bandwidth consumption in bytes per second.
Figure 2. The Flash Communication Server application inspector showing the activity of the live video tester (above)
The recommended audio sample rate is determined within ActionScript using the Microphone object and the following method:
Microphone.setRate(sample rate);
The live audio data rate is determined by multiplying the sample rate by two. See the matrix above for the recommended audio sample rates for various target bandwidths.
Note: Streaming video courtesy of Flash Video Streaming Service (FVSS), powered by VitalStream.