15.1. Exporting to Video In addition to web- and disc-based animations and applications, Flash can also be used as a limited video production tool. It is not useful as a video-editing program, but it can be helpful when creating video assets to use therein. Flash can export to video in two formats: pixel-based video, for use in a traditional video-editing application, and as a Flash track embedded in a QuickTime movie as part of QuickTime's Media Layer architecture. 15.1.1. Pixel-Based Video If you're one of the many people who use their computers to create videos, and maybe even DVDs, you may want to use Flash to convert your animations into video format, or to create titles or other simple effects for your videos. Exporting broadcast-quality video from Flash requires a little preparation. Bearing that in mind, try adapting your first animation for video export: Open the animation_complete.fla file from the 03 folder in your working directory. Choose File Save As, and save the animation as 15 folder. This will allow you to modify your document freely without overwriting the original. Use Modify Document to change the frame rate of your original movie to 30 frames per second. Flashs default frame rate is 12 fps, but high-quality video typically runs at 30 fps. (The exact rate for broadcast TV in the United States is 29.97 fps, but it differs slightly in other countries.) Before exporting, test your movie. Depending on how fast your computer is, your movie will play at up to twice the speed it used to play, which is too fast. To fix this, you must add frames to your animation. This will simultaneously slow down the animation to normal speed and make it much smoother. The .swf version started out as a 4-second animation: 48 frames at 12 fps. To achieve that length again, you must end up with 120 frames at 30 fps. Somewhere between frame 1 and frame 12, where the first box scaling occurs, click in the bar where the frame numbers are visible above all the layers. Clicking here ensures that no single frame is selected and prevents you from accidentally adding frames to only one layer. Add 18 frames to the animation by pressing F5 18 times. The final keyframe that was in frame 12 should now be in frame 30, as seen in Figure 15-1. Figure 15-1. The timeline, after adding the first group of frames to match the new frame rate Next, add 10 frames to the tween of each word. (Because of the layer structure, this will automatically tween the number 8.) Again, click in the numbered frame bar above all the layers to avoid accidentally selecting and adding frames to only one layer. Remember that these tweens are staggered, so try not to accidentally lengthen each tween more than once. Looking at Figure 15-1 as an example, good points at which to insert new frames include frames 35, 44, 51, 55, and 61. All that remains to reach your desired 4-second animation is to add a few more frames to the end, so the entire animation concludes at frame 120. Save your work. If you want to check the file, compare it to animation_video_02.fla. With the adjustments made, you're ready to create a QuickTime movie from your Flash file: Choose File Export Export Movie to open the Export Movie dialog box. .
In the Save As field, specify animation_ video.mov as the filename and choose "QuickTime Video" from the Format drop-down list. Save your file in the 15 folder of your working directory. The Export QuickTime Video dialog box, shown in Figure 15-2, will open. Figure 15-2. The Export QuickTime Video dialog. Enter 500 in the Width field, to match the Stage dimensions. If the "Maintain aspect ratio" option is enabled, the Height field will adjust accordingly. For maximum quality when editing your final video, it is best to export in uncompressed format. If you don't have the storage capacity for the considerable size of uncompressed video, another lossless codec (compression/decompression algorithm) is preferred. The Animation codec, when set to its highest quality setting, fits the bill and is particularly well suited for typical Flash movies, as they usually contain large areas of solids. This animation has no audio, so choose Disable from the "Sound format" drop-down list. Click OK to export the QuickTime video. Locate animation_video.mov in the 15 folder and double-click it to preview your file in the QuickTime Player. You now have a video that can be integrated into most video-editing environments. There are a few things to remember when planning such a process. Space prevents an in-depth analysis of each of these items, but here are a few quick points to consider: Exporting to rasterized ( pixel-based) video ignores all scripts, so you can't use ActionScript to control your animation. Movie clips won't play, so you need to use graphic symbols instead, and you can't rely on movie clip control (see number 1). Advanced: If you must use scripts or movie clips, you can bring the Flash file into Director and export to QuickTime from there. However, as of this writing, Director MX 2004 only supported up to Flash Player 7 .swf output. So, you won't be able to take advantage of Flash 8specific features. Although HDTV is changing the television horizon, the NTSC color palette used for analog television broadcast in the United States is more muted than the RGB color palette. Try to design in the NTSC palette to avoid color blowouts. Another thing changing with the wider use of HDTV is aspect ratios. The majority of televisions, however, still use rectangular pixels, rather than the square pixels of a computer monitor. To achieve the standard full-screen 720 x 480 final size, compensate by starting with Stage dimensions of 720 x 540. Finally (and yet another thing changing with the improved HDTV), most televisions underscan the information provided, effectively cropping the image. It is typical to allow yourself a 510% bleed of the width on the left and right, and the same percentage of the height on the top and bottom, to make sure important art is viewable. The area within these boundaries is commonly called the safe area. It is also a good idea to allow another safety margin of 510% within that region for important text. This is called the title safe area. 15.1.2. QuickTime Media Layer As Flash video technologies have improved, creating interactive or vector/pixel hybrid video projects directly within Flash has become increasingly common. This allows you to use the latest versions of ActionScript, Flash, and FLV formats for the best quality/feature mix. However, there may be instances when you want to combine Flash and QuickTime. QuickTime's ability to contain many different tracks of many different asset typessometimes referred to as the QuickTime Media Layer (QTML) architecturemakes this possible. For example, you may want to capitalize on a particular video quality or codec but add a password-protection scheme directly into the video, or you may want to embed a custom-made controller, high-quality text overlays, or other elements directly into a video. All of this is possible by exporting a Flash file into a QTML track. 15.1.2.1. Version support There are significant limitations, however. QTML files won't behave the same in all situations. For example, many types of tracks are ignored in more traditional video environments, so they should not be used the way pixel-based QuickTime video files are used. Further, the QuickTime version current as of this writing supports only Flash 5 ActionScript. This means that if you intend to create a hybrid of Flash vectors and video for an interactive QuickTime asset, you must limit your programmed features to those that are supported by that generation of ActionScript. An easy way to do this is to set your file to export a .swf compatible with Flash Player 5, prior to beginning the project: Create a new Flash document, and save it temporarily using any filename and location. (You will move on to a video project in a moment; this step is just to familiarize you with Flash 5 output.) Select the File Publish Settings menu command. Select "Flash Player 5" from the Version menu, as shown in Figure 15-3. Figure 15-3. The Publish Settings dialog box Next, open the Actions panel and look at the ActionScript menu on box the left. Many entries are highlighted in yellow, as seen in Figure 15-4, indicating that they are not supported in the version of the Flash Player you have selected. Figure 15-4. The Actions panel, highlighting features disabled by the Flash Player setting chosen in the Publish Settings dialog If you avoid the highlighted entries, your file will usually work fine when embedded in a QuickTime movie. Most of the ActionScript compatible with Flash Player 5 will work in QuickTime. However, some things, such as fscommand actions, are not understood. These commands are designed primarily for issuing instructions to a standalone projector for disc-based playback of Flash files, which you learned about in Chapter 14. 15.1.2.2. Exporting the QTML track Now apply what you know to exporting your file: If it's not still open, reopen the animation_video.fla file. Choose File Export Export Movie to again open the Export Movie dialog box. Save the file in your 15 folder. The Export QuickTime dialog will open. In the first part of this project, you'll create a Flash track that you can later add to an existing QuickTime document. Therefore, you don't need to worry about the QuickTime alpha and layer compositing features, a controller, or playback features. This animation has no sound, so you don't need to compress it in QuickTime. Be sure to turn on the "Flatten (Make self-contained)" setting, though, as shown in Figure 15-5, so your movie doesn't rely on any other assets and can function entirely on its own. Figure 15-5. The Export QuickTime dialog Click OK to export the movie. Open the file in the QuickTime Player, and you'll see that the quality of the vectors is preserved. This is now a Flash track inside a QuickTime layer, rather than a Flash animation that has been rasterized into pixels, frame by frame. Many developers prefer to composite QuickTime layers in a QTML-savvy editing application. However, if you know you want to merge a Flash track with a video track, and you have all the assets ready, you can do so right in Flash. 15.1.2.3. Exporting merged video and SWF tracks The difference between this next project and the video work you did in Chapter 9 is that the video you work with here will neither be entirely embedded nor an external FLV that is loaded at runtime. Instead, you will link to a video during authoring, and then export the Flash and video tracks together into a QuickTime file. Note: To review the sample code associated with this project, you must have the .mov and .fla documents in the same directory. Since enough room exists on a CD to duplicate these files, this step has been taken for you. However, if you don't want duplicate files on your hard drive, feel free to move either file into a new directory. For clarity, the steps discussed herein will be based on the provided CD directory. To export merged video and SWF tracks: Create a new Flash document, and save it as linked_video.fla in the 15 folder of your working directory. Choose File Publish Settings and specify Flash Player 5 compatibility in the Version menu. Import the nero.mov video, just as you did in Chapter 9. This time, however, choose the "Linked QuickTime video for publishing to QuickTime" option. Note: In authoring mode, you can preview the video live, but without sound. Since you must export the file as a QuickTime file, testing the .swf will not include the video.
The same dialog that you saw in Chapter 9, telling you how many frames are required to show the video, will display. Click Yes and allow the timeline to be adjusted. Add a marker layer and place markers at the three distinct sections of the video. Using Flash's default frame rate, these will be at approximately frames 50, 511, and 703. (If you want to factor in the soundtrack, you can set the last marker at approximately frame 798.) Name these markers nero, archie, and dinner, respectively. Create buttons that you will program to play, pause, stop, and move to each of the three makers you created. Label them accordingly, and then place them beneath the video at a _y value of approximately 260. At this point, you would normally give each button an instance name and assign each one an event handler in a frame script. However, ActionScript compatible with Flash Player 5 (required for export to the QuickTime format) did not support button instance names. So, revert to the basic use of applying handlers directly to your buttons. Select the play button and add this script to the Actions panel: on (release) { play(); } Add the same event handler directly to each of the other buttons, adding the following instructions: //PAUSE: stops the timeline but allows you to continue later, if desired stop(); //STOP: both stops and resets to frame 1 gotoAndStop(1); //NERO: goes to the frame label "nero" gotoAndPlay("nero"); //ARCHIE: goes to the frame label "archie" gotoAndPlay("archie"); //DINNER: goes to the frame label "dinner" gotoAndPlay("dinner"); Now you can export your movie as QuickTime again. For now, continue with all the default settings, as you did previously, but this time enable the "Paused at start" playback option. The result should resemble Figure 15-6. Figure 15-6. Your animation playing in the QuickTime Player The video will be paused, and the play, pause, and stop buttons should work as described. The Nero button will jump to the start of the video, when Nero the lionfish appears (skipping the title). The Archie button will jump to the first appearance of Archie the shrimp, and the Dinner button will jump to the beginning of the lionfish feeding. Notice, however, that the background beneath the buttons is not black, as it was in the .fla. This is because you used the default Flash/QuickTime Alpha and Layer compositing options. By default, the Alpha setting will make the Flash Stage transparent, and the Layer setting will place the Flash file above all other video tracks during export. As an experiment, re-export using the same process as before, but change the Alpha setting to Copy. Be sure to press the play button so you can hear the audio source, but you will see no video. This is because the Flash track has been made opaque, but it's still in the top layer. Finally, re-export using Copy and Bottom for the Alpha and Layer settings, respectively. Now the Flash layer is opaque, and beneath the video. Note: If you didn't get the same results, compare your work with the provided .fla and final .mov files. (If, after copying files, you find it necessary to re-establish the link to the external video file, simply right/Ctrl-click on the video in the Library, and edit its properties.) |