How to use the technologies
Flash Live Video Streaming Tutorial
Flash is a multimedia authoring environment developed and distributed by Adobe Systems. Webcasting with Flash technology requires Adobe's Flash Media Server (formerly Flash Communications Server), Flash Media Encoder, and Flash. Alternative servers, such as Red5 open source Flash Server and Wowza Media Server can replace Flash Media Server, but were not tested in this study.
Live video requires at least one broadcaster and one Flash Media Server (FMS). It is possible to use multiple broadcaster to send multiple video streams to the FMS, and it is also possible to use multiple FMS in the form of "Edge Servers" to accommodate distribution over large networks, client loads, and geographies. For this study, a single FMS was used with no Edge configuration.
A Flash application (SWF) running on the broadcaster captures a local camera signal, and distributes that signal via Real Time Messaging Protocol (RTMP) to a named stream on the FMS. The FMS then relays that stream to clients requesting it via the net.
This explanation has been simplified somewhat; the details of Flash live streaming used to be very complicated - generally because Adobe did not provide a universal set of tools for the task. To properly webcast using Flash, custom tools and some level of programming experience were required. In early 2007, Adobe quietly introduced Flash Media Encoder, which makes Flash live video streaming much easier.
If you don't have Flash Media Encoder on your streaming computer, please download it for free and install it now. It is Windows-based only for now.
Before you start streaming via Flash Media Encoder, make sure Flash Media Encoder is added to the Firewall exception. To do so, on a PC, go Start menu > Control Panel > Windows Firewall > Click the Exceptions tab > Check if Flash Media Encoder is in the list. If not, Click Add Program, find it, and add it. Click OK.
Please follow the following steps to achieve an optimized streaming.
- You can use a webcam on your computer to do live streaming. For higher quality streaming, use an external digital video camera. To do so, you need to connect the camera via a Firewire or USB cable. Turn on the camera and switch it to the Camera mode.
- Launch Flash Media Encoder on a PC. The left pane is input, and the right pane output. Under the Input pane, choose your camera in the Device drop-down menu both for video and audio. Make sure both Video and Audio are checked. A weird thing is that, when Audio is not checked, what is streamed is not exactly what the camera is looking at. That might be a bug.
Setting up Streaming
- Before you set up a stream in Flash Media Encoder, your Flash Media Server admin should have set up a "live" (or any name you like) folder under the main "applications" folder on the Flash Media Server. This "live" folder contains nothing but the "main.asc" file, a Flash ActionScript Communication file. The main.asc script ships with various Adobe software, including Dreamweaver and Flash.
- Under Preset, pick a preset. The High Bandwidth (800 Kbps) version should be fine for most broadband users. All the default video and audio settings are fine.
- Under the Output pane, check all the previews. Check Stream to Flash Media Server.
- Click the Output drop-down menu to choose Metadata. Fill in all the information if you feel necessary. You can add more information by clicking the Add (+) button. After you are done, switch back to Output.
- By FMS URL, provide the URL using rtmp protocol. It looks something like rtmp://in-info-media1.informatics.iupui.edu/live.
- By Stream, give a session name. Let's call it "test." Click the Connect button to connect to the Flash Media Server.
- If you wish to record the live streaming, check Save to File and create a file name under an appropriate folder.
- Click the green Start button on the very bottom. Your live video should be up and running, and you can see the bit rate being streamed in the Status panel.
Creating an SWF File
Yes, the video is being streamed, but very few users may know how to view it because the dual existence of Flash Player as a plug-in and stand-alone Flash Player can make un-sophisticated users very confused and not many users have the stand-alone Flash Player installed. To make viewing easy, an SWF file needs to be created so that anyone can view the live stream in any mainstream Web browser, such as IE, Firefox, Safari.
- Launch Adobe Flash. Save the empty file in a newly created folder. Let's call the file name "bird."
- If the live streaming is using a 360x240px frame size, you need to change the stage size to 360x240px in the Property Inspector on the bottom.
- From the Window menu on top, select Components and Component Inspector one after another so that both show up on the right if they have not shown up yet.
- From inside Components, check the cross by FLV Playback - Player 8. Drag an instance of FLVPlayback to the stage. Change the size also to 360x240px, and center it to the stage by using the Align tool from the Window menu.
- Here comes the crucial part. Click the FLV Playback on stage to select it. Double-click the blank by contentPath in the Component Inspector, key in the full URL of the streaming by using the RTMP protocol. It looks something like this: rtmp://in-info-media1.informatics.iupui.edu/live/test. Remember "test" is the streaming session name we gave earlier in the Flash Media Encoder? Uncheck both Match source FLV dimensions and Download FLV for cue points and dimensions. Click OK.
- Still in the Component Inspector, choose "true" by isLive. This is important, or the live streaming won't happen. If you wish to change the skin, you can double-click the blank by skin to make the change. Otherwise, leave skin alone.
- Press Control and Enter keys to generate an SWF file immediately to see if the live streaming is viewable. If not, you might have missed or mis-conducted some step(s) described above. If you can view the streaming, close the SWF file.
- Go File menu > Publish. You will have generated three more files—one is a skin file, one is the main SWF file called "bird.swf," and the last one an HTML file called "bird.html."
- Use an FTP client (Dreamweaver, SSH, etc.) to send all the files inside that newly created folder except for the FLA file, the Flash production file, to a Web server of yours.
A user can use any mainstream Web browser to view the stream. The URL should be something like http://www.informatics.iupui.edu/bird.html. The first part is the Web server name, and the second part the name of the exported HTML file that contains the live stream.