From the standpoint of the interface, converting non-Flash video (such as QuickTime or AVI video) to the Flash-friendly FLV format is quite easy. Flash has an importer that does just about all the work. The challenging part isn't working through a complex set of steps, but rather in making educated decisions as you work through the import wizard.
In this task, you'll import a QuickTime video that has been provided for you. To do so, you'll work through Flash's video import wizard. As you go through the screens in the wizard, you'll accept most of the defaults. However, we'll explore the options anyway, so you understand
why you're accepting the defaults and, more importantly, so you know when you should choose other options.
1. | In the timeline, select Frame 1 of the video layer. |
Before you import anything, you always need to tell Flash in which keyframe you want the item to appear, whether it's a video, image, or sound file.
2. | From the main menu, choose File > Import > Import Video. |
The Import Video wizard appears, with the Select Video screen active.
3. | Click the Browse or Choose button and navigate to the FarmersMarketVideo.mov file, which is provided on the CD-ROM in this lesson's Start folder. Click Continue. |
Immediately, you're faced with a decision concerning the location of the file. If the file is on your local computer, as it is in this case, select the On Your Computer radio button and browse to the file. If the file is already on a server, provide its address here.
Note
Different kinds of servers host video in different ways. If the file is sitting on a regular Web server, it's treated much like any other file. However, video-streaming servers, such as Flash Communications Server, offer special features. Note that you're not limited to http:// when specifying video URLs; you can also use the Flash Media Server rtmp://protocol.
4. | In the Deployment screen of the Import Video wizard, leave the default set to Progressive Download From a Web Server. Click Continue . |
Flash can work with video in a number of different ways, and this screen presents perhaps the most important decision that you'll make. The deployment methods are as follows:
Progressive download from a Web server. The video is converted to an FLV file and stored outside of the Flash SWF in which it appears, and it is streamed into Flash over standard HTTP. User interface and scripting controls in the SWF file itself control the user experience. This option requires the Flash 7 player, which was released in 2003, or higher.
Stream from Flash Video Streaming Service. The Flash Video Streaming Service is a hosted Flash Media Server account. It offers improved features and functionality over standard HTTP video streams, but you have to pay for the service.
Stream from Flash Media Server. This option is very similar to the previous one, the main difference being that you're hosting the Flash Media Server yourself, rather than working through a third party. Again, it's more expensive than the Progressive download option, and it is more full-featured.
Embed video in SWF and play in timeline. This option is the most intuitive, and yet is probably the worst choice. The video is actually imported into the SWF itself and plays on the timeline, just like any other Flash asset (such as an image or a graphic symbol). However, video is not like any other Flash asset, and introduces problems, such as bloated SWF file size, sound synchronization issues, and other performance problems. This option is generally not recommended, unless the video is very short (say, a few seconds), it doesn't contain a soundtrack, and/or you're limited to the Flash 6 or earlier.
Linked QuickTime video for publishing to QuickTime. This is a legacy option, which is available only if you're publishing to the antiquated Flash 3, 4, or 5 players. It lets you export the Flash content in the QuickTime MOV format, which is playable in the QuickTime player with the added benefit of Flash features, such as basic interactivity.
In most situations, if you use video sparingly, Progressive download is the option you should use.
If you're using video heavily, you should consider upgrading to a Flash Media Server, either through an external hosting solution such as Flash Video Streaming Service, or by hosting your own copy of the Flash Media Server. Flash Media Server enables faster startup; far better control over the video, including deep interactivity with the video; live video; improved seek and navigation; and even tracking and logging capabilities.
Avoid embedding video unless it is only a few seconds in duration, has no sound, and is targeted to older Flash players.
5. | In the Encoding screen, click Show Advanced Settings. View the various options, returning to the default (Flash 8 Medium Quality 400kbps). Then, at the bottom of Encode Audio section, change the Data Rate setting to 64 kbps (mono). Click Continue. |
The decisions you make on this screen have two primary consequences: file size and compatibility. The usual tradeoffs are in full force: video quality, file size, and compatibility. You can usually prioritize any two of these, but at the expense of the third.
For example, by sticking with the default you'll obtain the highest possible quality and lowest file size by using the latest codec; in doing so, however, you sacrifice compatibility, because some visitors might have older Flash players that lack the latest codec. You can switch to an older codec, thereby increasing compatibility, but because its coding algorithms aren't as good, the file size is likely to be larger and/or the image quality is likely to be lower.
codec stands for code-decode, and is the algorithm (computerized sequence of steps) used to compress and then decompress the video for playback. When publishing to the Flash 8 player, use the default On2 VP6 codec, which is superior to the older Sorenson Spark codec but is available only in Flash 8. If you want to include Flash 7 players, you should use the Sorenson Spark codec.
After you've chosen a codec, you can configure several of its characteristics (displayed in the Advanced settings in the lower half of the window). These include the following:
Frame rate: Higher frame rates render the original video more faithfully but increase the file size. Because external (progressive or streamed) video can have different frame rates than the parent SWF, you can make your decision without regard for the rest of the SWF. Most SWFs default to a low-quality 12 frames per second, while Hollywood movies are released at 24 frames per second. NTSC (the standard television picture in the United States) is broadcast at just under 30 frames per second. As a rule, you can use lower frame rates for low-action content, such as talking heads, and use higher frame rates for high-action content, such as sports.
Key Frame Placement: A video running at 24 frames per second could theoretically be rendered using a sequence of 24 bitmaps per second. However, the difference between any pair of sequential bitmaps (for example, the difference between image 1 and 2) is likely to be relatively small. Therefore, it's usually more efficient to describe the differences introduced in Frame 2, rather than to download an all-new image. Video compression algorithms, therefore, typically use only one full frame and then follow it with descriptions of the differences. For example, it might provide one full image and then 23 directions before providing a new full image. The full image, of course, is the keyframe, and the more keyframes you have, the higher the fidelity is likely to beand the larger the file size.
Quality: The quality refers to the amount of data that can be transmitted per second, which has a significant impact on streaming. Higher amounts take longer to download and display; lower amounts are less likely to reproduce the video faithfully.
Resize Video: If your video source is not the size you need, you can resize it. As a rule, decreasing the video size also decreases the file size.
Each of these options only specifies how the video should be compressed. If your source video has one or more audio tracks, you can also specify how they're encoded. As a rule, you'll use the MP3 audio format, and the only setting you can change is the Data rate. As always, higher data rates increase the potential fidelity, while lower ones mean better file size.
You specify 64 kbps (mono) here, because this video was recorded with a handheld camcorder with a mono microphone. There's no need to add the expense of a stereo-quality data rate when the audio track is mono to begin with!
Tip
So far this lesson has a lot of information to digest, and even this is but a sampling of the issues with which you should become familiar. For a jump start into the world of video, check out Macromedia's Flash Video Developer Center at http://www.macromedia.com/devnet/flash/vide228.
6. | In the Skinning screen of the Import Video wizard, select MojaveExternalPlaySeekMute.swf, and click Continue. |
Feel free to take a moment to explore different skins. There are four basic designs: Arctic, Clear, Mojave, and Steel. As you can see with some experimentation, a skin is a playback window design. It includes a color scheme and different combinations of button displays. In all cases, the movie will play back in the window the same. The differences, then, are cosmetic. Do you want a blue, brown, or gray player? Which buttons do you want? Where do you want the buttons to appear?
After you're finished experimenting, make sure you select MojaveExternalPlaySeekMute.swf. You chose Mojave because its brown color goes well with the natural and organic themes of the Jade Valley Web site. The distinction between Internal and External has to do with the location of the controls: over the video or outside the video. You chose External so the controls won't block the video, and because there's plenty of room in this design for the video. The remaining variations have to do with which buttons are available. You chose PlaySeekMute because they are all buttons that function in a progressive video. Had you chosen All, two more buttonsseek forward and seek backwardwould have appeared; however, these buttons won't function correctly unless you're streaming video from Flash Media Server or Flash Video Streaming Service.
If you've designed your own skin you can use it, provided that it's published on a server. In that case, enter the server location in the URL field, instead of choosing a skin.
7. | Click Finish. |
The final screen lets you review your selections and go back and make corrections before you start the process of converting the video to the FLV format.
8. | Save the file as farmer's market.fla inside the flash folder of the Jade Valley Web site. |
After you click Save, Flash initiates the process of converting the video to the FLV format, attaching the selected skin to the video, and so on. Once begun, the process may take a while. (On a dual-processor Macintosh G5, for example, the whole process took over 4 minutes. On a laptop, it will likely take much longer.)
When the import is finished, an instance of the FLVPlayback component appears on your screen.
9. | Adjust the position of the FLVPlayback component, as appropriate. Then test the movie by pressing Ctrl+Enter/Command+Enter. |
The movie plays back inside the component.