Delivery Options for Flash Video
Embedding Video Within SWF files
Since the introduction of Flash MX and Flash Player 6, multimedia developers have been able to embed video within SWF files by importing video and placing it on the Timeline in the Flash authoring tool. When the SWF file is published, the video is fully contained in that file. This approach requires only a normal web server to deliver the video.
However, embedded video is recommended only when you want visitors who have Flash Player 5 or lower to be able to view your video, or when you must have one single file that encapsulates the video and the Flash content, or when your video clip is under five seconds long. In all other cases, embedded video is not recommended.
There are some benefits to using embedded video, such as the ability to see the individual video frames on the Flash Timeline and create overlays and interactions with the aid of the Flash design tools.
However, embedded video has some limitations:
- If your video content changes, you must reopen Flash, re-embed the video, recheck and possibly rework any navigation and or associated content, and then republish the SWF file to make the change.
- During authoring, each time you want to preview or test part or all of your Flash content, you must publish the entire video file. This can add significant time to the authoring process.
- For web delivery, the entire video file must be downloaded from the web server in order for playback to begin.
- At runtime, the entire video file must fit into the local memory of the playback system.
- After approximately 120 seconds of continuous video playback, users may experience audio synchronization problems.
- File length is limited to a maximum duration of no greater than 16,000 frames.
- The video frame rate and Flash Timeline frame rate must be the same (because they share the same time base).
Therefore, the embedded-video approach is recommended only in specific cases as described above; and even in those cases, you should use it only when you want to deploy very short clips of video, when the quality of that video is not very important, and when the video content is unlikely to change very often.
About External Progressive Download
Flash Player 7 introduced a new technique called progressive download, which enables developers to use ActionScript commands to feed external FLV files into a SWF file and play them back at runtime. More specifically, you can use the netConnection and netStream commands to set the FLV file to play back, and to control the Play, Pause, Seek (to a timecode), and Close behaviors and the buffertime and size for a given video file.
In this method, the video content (FLV file) is kept external to the other Flash content and the video playback controls. Because of this, it’s relatively easy to add or change content without republishing the SWF file.
Flash Professional (starting with Flash MX Professional 2004) also includes video components that you can use to quickly add a full-featured FLV or MP3 playback control to your Flash project. In Flash Professional 8, the FLVPlayback component provides support for both progressive download and streaming FLV files. This component, new to Flash Professional 8, is easy to “skin” or customize, so that you can make your video player match your site design. Flash Professional also includes a set of behaviors that can be used in conjunction with media components to create automated interactions between video sequences and slides in a project. (For details on using ActionScript and video components, see the reference guide, which you can view using the Flash Help panel. For more information on using video behaviors, see Dan Carr’s article, Controlling Flash Video with the FLVPlayback Behaviors.)
Using external progressive FLV files has the following advantages over using embedded video:
- During authoring, you need to publish only the SWF interface for previewing or testing part or all of your Flash content. This results in faster preview times and quicker turnaround on iterative experimentation.
- For delivery, video begins playing as soon as the first segment has been downloaded and cached to local disk.
- At runtime, video files are loaded from the local disk into the SWF file, with no limitation on file size or duration. There are no audio synchronization issues or memory restrictions.
- The frame rate of the video file can be different from the frame rate of the SWF file, allowing for greater flexibility in setting up a project.
About Streaming Video
The most complete, consistent, and robust delivery option is to stream video and audio files from a server running Flash Media Server (formerly Flash Communication Server). In streaming, each client opens a persistent connection back to the video server, and there is a tight relationship between the video being delivered and the client interaction. This approach lets you deliver features such as bandwidth detection to serve up the right size video, quality of service metrics, detailed tracking and reporting statistics, and a whole range of interactive features along with the video experience.
As with progressive download, with this method the video content (FLV file) is kept external to the other Flash content and the video playback controls. It is, therefore, relatively easy to add or change content without the need to republish the SWF file. Further, because there is a persistent connection between client and server when streaming, the FLV content can be changed based on feedback from the user or the application. For example, you can switch to a lower bit rate video if you notice quality-of-service degradation.
This approach also has other advantages, such as the following:
- The video starts playing sooner than it does using other approaches.
- Streaming uses less of the client’s memory and disk space, because the clients don’t need to download the entire file.
- It makes more efficient use of network resources, because only the parts of the video that are viewed are sent to the client.
- It provides more secure delivery of media, because media does not get saved to the client’s cache when streamed.
- It provides better tracking, reporting, and logging ability—important features for industries such as video ad serving.
- It lets you deliver live video and audio, or capture video from a client’s webcam or digital video camera.
- It enables multiway and multiuser streaming for creating video chat, video messaging, and video conferencing applications.
- It provides programmatic control of streams (server scripting) for the creation of server-side playlists, synchronization of streams, smarter delivery adjusted to client connection speed, and application creation.
- It provides advanced monitoring and reporting on traffic and throughput.
Customers who do not want the difficulty and expense of buying and maintaining server hardware and Flash Media Server software can get all the benefits of streaming Flash video and MP3 files with the Flash Video Streaming Service. This service is a load-balanced, redundant deployment of Flash Media Server, hosted by a Macromedia-authorized Content Delivery Network partner. For more information, visit the Flash Video Streaming Service home page on macromedia.com.
Detailed Comparison of Delivery Options
The following table provides a comparison of the characteristics of Flash video delivery techniques:
|Embedded Video||Progressive FLV||Streaming FLV|
|Encoding||By default, the Flash Video Import wizard encodes video using the VP6 video codec for use with Flash Player 8, and the Sorenson Spark codec for use with Flash Player 7. Alternatively, FLV files (encoded elsewhere) can be imported and placed on the Flash Timeline (re-encoding is not necessary).||
FLV files are encoded during export from various professional editing and encoding applications through the FLV QuickTime Export plug-in, through the Flash Video Import wizard in Flash Professional 8, or they can be encoded with the stand-alone Flash Video Encoder.
Note: These options require Flash Professional 8.
|Same as Progressive FLV. In addition, bandwidth detection capabilities in streaming enable you to detect client connection and feed the appropriately encoded video. You can capture live video feeds from client-side webcams or Digital video (DV) cameras and control live encoding variables programmatically.|
|File Size||SWF files contain video and audio streams and the Flash interface, resulting in a single, larger file size. SWF files can load each other, enabling you to break up individual video clips into multiple files.||SWF and FLV files are kept separate, resulting in a smaller SWF file size.||Same as Progressive FLV.|
|Timeline Access||When embedded in the Flash Timeline, video appears on individual keyframes and can be treated like any other object on the Stage. Ideal for creating interactions based on individual keyframes of video.||Video is played back only at runtime. Individual keyframes are not visible on the Flash Stage.||Same as Progressive FLV.|
|Publishing||Each time the Flash content is published or tested the entire video file is republished. Changes to video files require manually reimporting the files into the Flash Timeline.||FLV files are only referenced at runtime. Publishing does not require referencing the video file directly, and is much faster than the embedded video approach. FLV files can be updated or modified without changing the SWF files for a project.||Same as Progressive FLV. You can dynamically pull FLV from virtual locations, such as your SAN or the Flash Video Streaming Service CDN.|
|Frame Rate||Video frame rate and SWF frame rate must be the same.||The FLV video file can have a different frame rate than the SWF file, allowing for separate timings between video and the other Flash content.||Same as Progressive FLV. Live video capture has programmable control over frame rate.|
|ActionScript Access||Video playback and control is achieved by controlling the SWF content’s playback on the Flash Timeline. Flash MX 2004 and Flash 8 include several behaviors for controlling video and audio playback.||You can use the netStream command to Load, Play, Pause, and Seek through multiple external FLV files.||Same as Progressive FLV. You can also use server-side ActionScript to provide additional functionality such as synchronization of streams, server-side playlists, smart delivery adjusted to client connection speed, and more.|
|Components||No video-specific components.||You can use media components (Flash MX Professional 2004 only) or the FLVPlayback component (Flash Professional 8 only) to set up and display external FLV files together with transport controls (Play, Pause, and Search).||You can use media components (Flash MX Professional 2004 only) of the FLVPlayback component (Flash Professional 8 only) with video streamed from Flash Media Server or Flash Video Streaming Service. Also, you can use Flash Media Server communication components for streaming live and multiway video.|
|Web Delivery||The SWF file progressively downloads, unless you embed it in a movie clip. In that case, the entire video must be downloaded to the client and loaded into memory before it plays back.||FLV files are progressively downloaded, cached, and then played from the local disk. The entire video clip need not fit in memory.||FLV files are streamed from Flash Media Server, played on the client’s machine, and then discarded from memory in a play-as-you-go method.|
|Performance||Audio and video synchronization is limited after approximately 120 seconds of video. Total file duration is limited to available RAM on the playback system.||Improved performance over embedded SWF video, with bigger and longer video and reliable audio synchronization. Provides best image quality, which is limited only by the amount of available hard drive space on the playback system.||Provides the best performance from a web delivery perspective, with optimal bit rate delivery on an as-needed basis to as many customers as necessary. Image quality limited to bit rates that can be delivered in real time.|
|Usage||Shorter video clips (less than 1 minute) that are smaller (less than 320 x 240), and have a lower frame rate (12 frames per second (fps)).||Longer video clips that are larger (720 x 480 and greater) and have a higher frame rate (up to 30 fps).||Large quantities of video, very long video clips, and live and multiway streaming (such as webcam chat and live event broadcasts).|
|Compatibility||Flash Player 6 and later (On2 VP6 codec requires Flash Player 8 or later.)||Flash Player 7 for Sorenson Squeeze codec, Flash Player 8 for On2 VP6 codec||Flash Player 6 and later|