Accessibility

Table of Contents

Dynamic stream switching with Flash Media Server 3

Step 1: Encoding for multi-bit rates

In the previous section I described how a multi-bit rate solution could be implemented to enhance the end user's video experience. In this part, we'll begin working with the sample video files. To follow along, you'll need multiple versions of the same video content to stream. Download the sample files provided on the first page of this article, or locate your own video files on your hard drive. You can use the Flash Video Encoder (which ships with Flash CS3 Professional) or Adobe Media Encoder CS4 (which ships with Flash CS4 Professional) to encode the video at different bit rates. Alternately, you can also use other video encoding options that are described at the end of this section.

One of the primary requirements to providing a clean solution for dynamic bit rate stream switching is having a set of videos of different bandwidths available from a single source. This will enable us to determine which file is best suited for the end user at the different bandwidths they may connect at or shift to over time. The key factors we need to manage between the videos are as follows:

  • Video bit rate: This generally relates to the video's quality and how much data (bandwidth) is required to play the video back. This factor drives the primary file size and visual compression quality settings. Changing the bit rate for each file is the most important element in creating different files for each bandwidth bracket.
  • Audio bit rate: This relates directly to the audible quality heard by the end user. Since the audio usually adds a substantially less amount of file size in relation to the video bit rate, it is generally recommended to use the same audio bit rate across all encoded files in a set in order to maintain audible clarity and consistency as streams switch.
  • Frame size: The physical dimensions (width/height) of the video. For the purposes of this solution, we'll want to keep the frame size fixed across the set of videos to ensure a smooth transition when switching from one video to the next.
  • Frame rate: This specifies the number of frames per second attempted when playing back the video. This setting primarily affects the smoothness of the video. Using a consistent frame rate across all the encoded videos can also help smooth the switching transition between the different bit rate streams.

Let's get started by preparing some video for streaming. We'll encode videos for several different bit rates:

  • 150 Kbps (lowest quality)
  • 300 Kbps (increasing quality)
  • 500 Kbps (reasonable quality)
  • 700 Kbps (near HD)
  • 1.5 Mbps (full web HD)

Ensure that all of the encoded videos use the same frame dimensions. We'll be switching between the videos as they're playing, and the transitions will be smoother if all of the videos in a set have the same frame dimensions.

Encoding walkthrough

The sample video source is encoded as a High-Definition QuickTime MOV file using the H.264 MPEG compression at an approximately 5 Mb/second bit rate encoding and AAC audio. The source file has the frame dimensions of 1280 × 720 and a frame rate of 24 fps. It is most definitely not a web ready video, but it suits our purposes well as the master source file to use when encoding the web versions we'll deliver.

It is important to note that whenever you are encoding your own video you should always strive to use the highest quality, least compressed source to achieve the best results. In this walkthrough we will use the bit rates listed above to encode the web-quality video clips in preparation for setting up the dynamic bit rate swapping in the later exercises:

  1. Open Flash Video Encoder. Click the Add button to add a video file to the queue.
  2. Navigate to the AdobeMax2007_720p.mov file in the provided sample files folder (or choose your own high quality video source) and click Open.
  3. Select the video listed in the queue and click the Settings button. The Flash Video Encoding Settings dialog box appears.
  4. Set the Output filename to AdobeMax2007_720p_150. Switch to the Crop and Resize tab. Check the Resize video checkbox, and then set the height to 240. The width should automatically resize to 426 (see Figure 2).

    screenshot_FlashVideoEncoder1.jpg

    Figure 2. Select the option to resize the video and set the height to 240 pixels

  5. Switch to the Video tab and make sure that the frame rate is set to Same As Source, which is the default setting.
  6. Set the Max Data Rate field to 150 kilobits per second. Leave all other settings as the default settings, and then click OK.
  7. In the queue, select the video you just modified. Click the Duplicate button. This will add another video to the queue.
  8. Select the duplicated video and click on the Settings button. Change the Output filename to AdobeMax2007_720p_300 and then switch to the Video tab and change the Max Data Rate to 300 kilobits per second. Click OK.
  9. Repeat Steps 7 and 8, creating videos at 500, 700, and 1500 kilobits per second, changing the Output filename for each to reflect the corresponding Max Data Rate (see Figure 3).
  10. Once you've added all these videos to the queue, click the Start Queue button. Flash Video Encoder will process all the files and output them to the same directory as the source video file.

Duplicate and add settings to create three more versions
          to encode

Figure 3. Duplicate and add settings to create three more versions to encode

That's all you need to do to encode the video sample files for this article. Keep in mind that there are other settings you can tweak later to provide your users with more viewing options. You can encode videos at different levels of smoothing or at different frame sizes. Although switching between videos with different settings for smoothing and frame sizes is outside the scope of this article, you may wish to experiment later with switching between videos using these settings as well.

Other encoding options

Adobe works with partner companies to provide Flash Media Server assistance, including video encoding services. Encoding partners can set up solutions such as server-based transcoding or simpler needs, such as batch encoding of media files. Table 1 includes a list of Adobe partners and the type of Flash Media Server services they provide. To learn more, see the Flash Media Server: Ecosystem partners.

Table 1. Flash Media Server services of Adobe partners

Publishing Encoding Ad delivery Consulting
Brightcove Anystream PointRoll Digital Primates
DBee Digital Rapids EyeWonder Fig Leaf Software
ExtendMedia Envivio Inc. Unicast Intesolv
The FeedRoom Inlet Technologies VoloMedia New Toronto Group
Jalipo Kulabyte YuMe Networks RealEyes Media
Maven Networks Media Excel SAIC
Multicast Media On2 Technologies TCi
Onstream Media RipCode Universal Mind
stimTV Sorenson Media
Streamedia Telestream
TANDBERG Television ViewCast
thePlatform