26 September 2011
Successful completion of Part 2 in this tutorial series is recommended. Previous experience deploying streaming video online is helpful.
Beginning
This is the third in a loose series of beginner's guides on learning Adobe Flash Media Server 4.5. This particular tutorial shows you how Adobe Flash Professional CS5.5, Adobe Flash Media Playback, Adobe Flash Media Live Encoder 3.2, and Flash Media Server 4.5 team up to give you the ability to create live video streams from your own webcam or other sources.
Here are all of the articles in the series (links will become active as the articles are published):
As a teacher and lecturer who tends to spend an inordinate amount of time in the Flash space, Tom loves to show his students how to use a webcam with Flash. It is one of the easiest things to learn and has immediate rewards. Inevitably, though, students ask, "Can I stream this live?"
Depending on the audience, this is a rather awkward question to answer. If we're dealing with an advanced group that has a deep understanding of ActionScript, the answer is, "It's a little tricky but not terribly difficult to accomplish." For everyone else, the answer is, "You really don't want to go there." Now when he's asked about streaming live video, his response is, "Can you click a mouse and type one line of code?"
In this exercise you are going to do the following:
Every now and then an amazing piece of software hits the street. Inevitably, the company puts it out in public beta and you can't help but think, at some point in the process, "Dang, this is sweet. I sure hope I can afford it." Tom had that reaction when he first tried out Flash Media Live Encoder (FMLE). If the truth be known, he's still having a hard time grasping the fact that this powerful piece of software is free. (It's also available for both Mac OS and Windows.)
Its purpose is quite focused: to grab a video or audio feed and either encode it, on the fly, to a common video file or stream it out—live. In this part of the exercise, we'll take you through the Flash Media Live Encoder interface and use it to create an FLV/F4V file. Keep in mind that this will be a "drive-by" exercise; we won't get into the nuts and bolts of using FMLE. Our colleague, Greg Hamer, has already written a really good overview of this process in his article, Webcasting live video with Flash Media Live Encoder.
Note: We are going to be using the Mac OS version of Flash Media Live Encoder 3.2 for the first part of this tutorial so that you Mac users can follow along. If you have a PC, there is no difference in technique. Just be aware that the last part of this article shows you how to stream a live feed from FMLE through the local Flash Media Server 4.5 installed on your PC and will be Windows based for obvious reasons.
Follow these steps to make the initial configuration in Flash Media Live Encoder:
The input area is further subdivided into separate Video and Audio areas where you can tweak the settings prior to capture or broadcast. If you are unsure of the settings to use, select one of the many presets in the Preset pop-up menu. Still, it doesn't hurt to try this application out, so let's create a simple capture.
Note: You can use a variety of webcams and even digital video recorders to capture the video. For a list of devices that Adobe has specifically tested for use in this software, visit the Flash Media Live Encoder Device Compatibility Matrix. As you can see, the list is quite comprehensive and even includes audio capture devices. Still, the list is in no way definitive; it simply lists devices tested by Adobe so far.
At the bottom of the window, you will see the total bit rate, which is the sum of the audio and video bit rates. This is an important number because it has a direct effect on user experience. If you are unsure of what numbers to use, head over to Robert Reinhardt's Flash Video Bitrate Calculator.
Having dealt with FLV settings, you can turn your attention to actually creating the FLV file:
Now that you have created an FLV file, it's time to play it:
Now that you know how to create an FLV file using Flash Media Live Encoder, it's time to put that knowledge to work and create a live broadcast. Rather than get into Flash Professional and a lot of code, we are going to use a video technology that is, for the purposes of this article, dead simple to use. The technology is the Open Source Media Framework (OSMF) which we will get into in greater depth in "Part 5: Streaming with OSMF players."
Let's go live with OSMF:
When you make this selection you are going to see an FMS URL (rtmp://localhost/live/) and, in the Stream area, a stream named livestream will appear. These two little bits of information (see Figure 6) are important; write them down as a path (rtmp://localhost/live/livestream) because you are going to need it when you create the live feed in OSMF.
You may be looking at this path and wondering, "What does it mean?" This is a good question. In Part 2: Streaming on-demand video, you created a VOD application using FMS 4.5, requiring the Flash Media Server to be running. If you open Flash Media Server 4.5/applications on your Windows-based computer, you will see a folder named "live". You can assume from this that the URL in Flash Media Live Encoder is sending the stream directly to this folder on the server. Each stream needs a unique instance name, which is the purpose of the Stream area.
At this point in the process, you need to move away from FLME, without quitting the program, and open Flash Media Playback. You will be using the Configurator, which requires only one bit of information and is a great way of testing any FMS application—live or otherwise.
To use the Configurator, follow these steps:
http://www.osmf.org/configurator/fmp/
The embed code at the bottom of the preview is really neat. You can simply copy and paste this code into a web page; you don't even need to use Flash to run a live video stream from your website. Just be aware that this is a test and the best results are obtained using a fully functioning Flash Media Server.
This tutorial showed you how Flash Media Server 4.5 and Flash Media Live Encoder combine to give you a live video and audio streaming capability that's simple to master. If this subject has caught your attention, here are a couple of other articles that will get you going:
Part 4 covers streaming audio into a Strobe Media Player available to you through the Open Source Media Framework.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
Tutorials & Samples |