s Flash becomes more and more popular as a Web video delivery platform, I receive more and more questions regarding its use. In fact, I receive more inquiries about video than any other Flash-related topic. When you consider the video delivery marketplace, it's easy to understand why. The Flash Player reaches more users than any other video player, including QuickTime, Windows Media Player, and Real Player, so developers are looking to Flash in increasing numbers for their video needs.
I may not be able to respond to every email I get, but I can dedicate my next several articles to answering many of the Flash video-related questions that readers and students ask me. This month, I'll discuss Metadata in FLV files: why it's important, why it's not always there, and how you can create metadata when it's absent.
What is Metadata?
Metadata essentially means data about data. In this case, the information that composes an FLV file is the primary data, and the metadata is information about that video. The length of the video (duration), the number of frames per second that the video displays (frame rate), and the number of kilobytes of data transferred per second when the video plays (video and audio data rates, where applicable) are all examples of video metadata.
In many cases metadata is useful non-essential information that comes in handy when searching for or querying a data asset. For example, think about a digital image database, and think of a keyword field in which you can add descriptive words about the image. Other examples of metadata, however, can border on indispensable. Reconsider the same digital image library, and think about the width and height fields in that database. Without that information, it would be much harder to display the image properly. The same types of metadata and, unfortunately, the same kinds of problems, apply to FLVs.
Video without Progress
To understand what happens when metadata isn't properly added to an FLV during the encoding process, consider an example using Flash's MediaPlayback component. Just as scientific progress stalls without data, the progress of an FLV is not automatically reflected by the component without metadata. If you began using the component when it was introduced, for example, you had to enter a duration in the Component Inspector for the preload and progress bars (in the component scrubber, as pictured in Figure 1) to function. Because no metadata existed in the FLV the component couldn't calculate the width of these bars during playback without someone manually entering the duration.
|Figure 1. Declaring Duration: When duration metadata is not properly added to the FLV during encoding, the progress bar (seen in green above the pause and rewind buttons) in media components cannot calculate its correct width. In these cases, you must manually enter the duration of the FLV in the Component Inspector or inject the correct metadata using third-party tools.
The same is true with width and height. Components and custom players alike, that rely on retrieving the width and height of the FLV from the file, fail to correctly size themselves and/or the FLV when the relevant metadata is missing or incorrect. This is especially important for FLV files because unlike QuickTime, for example, you can't easily open an FLV in a player and determine the dimensions of the file.
Among the early FLV encoding tools, the following versions did not add metadata to FLVs properly:
- Flash Video Exporter and Encoder (a free FLV codec for QuickTime and standalone encoding application, respectively, that shipped with Flash MX 2004) prior to 1.2
- Sorenson Squeeze (a commercial third-party encoding application that supports FLV compression) prior to 4.0
- Flix Pro (formerly from Wildform, now developed by On2) prior to version 8
Problems also exist in later versions of some of these applications. For example, versions of Sorenson Squeeze between 4.0 and 4.2 added metadata but did not do so properly. Notably, the size of the video was added incorrectly. In a 320 x 240 test FLV created for this article in version 4.1, for instance, the file reported its size as 320 x 320.
Where does that leave you today? Fortunately, current versions of these tools all add metadata to FLVs correctly, which is fine if your software is up to date. But what should you do if you find yourself just shy of compatibility? Fortunately, two generous, talented programmers have donated to the Flash community a pair of free command-line utilities that inject metadata into existing FLVs. Using these utilities metadata can be added to previously created FLVs; it also means that additional metadata, including custom information, can be added.