Importing Video

I l @ ve RuBoard

Before Flash MX, you did not have the ability to embed video clips in a Flash movie. You could simulate video by converting a video clip to a series of bitmap images and placing those images in sequential frames of a Flash movie. Your other option was to bring a linked QuickTime video into your Flash movie during the authoring phase, create Flash animations around it, and export the whole thing as a QuickTime file. This option limited your ability to provide interactivity, however, since QuickTime currently supports only those interactivity features available in Flash 4. (At the time this book was writ en, Apple had announced that QuickTime 6 wil support Flash 5 files.)

You still have the option to work with linked QuickTime video clips, but Flash MX also allows you to embed video clips for playback directly in Flash Player. With embedded video, you can create movies that use all of Flash's animation and interactivity capabilities. In addition, anyone who has the Flash 6 player can play embedded video; there's no need for QuickTime or other plug-ins.

The first step to using video with Flash is to import the video file, just as you would import graphics or sounds from other external sources.

The Mystery of Video-Import Settings

The key to working with video in Flash is Sorenson Media's Spark codec. Spark carries out Flash's video import functions by encoding and decoding (compressing and decompressing) the video data to bring clips into Flash. Your goalthe ever-present juggling act for Web developersis to balance quality and file size . Here's a quick overview of how Spark's video-import settings help you maintain that balance with video clips.

Keyframe Interval. The term keyframe here refers not to the keyframes you set in Flash, but to the crucial frames created as Spark compresses the video clip. To reduce the amount of information in the clip, Spark does not usually encode all the data required to re-create a full-frame image for every frame in the video clip (although you can tel it to do so). Spark encodes the fullframe image only for keyframes. For the other frames, Spark encodes information about how the frame differs from the preceding keyframe and uses that data to create an updated version of the keyframe. The Keyframe Interval setting tells Spark how often to encode a full frame. It's a bit of a brain-twister, but higher numbers here translate to smaller files sizes in your published movie. A higher number means a larger interval between keyframes, which means fewer keyframes, which in turn means that there will be less data to transmit for the finished Flash movie.

Quality. In addition to reducing the amount of video data by not describing each frame fully, Spark applies JPEG-like compression to the image data. A Quality setting of 100 gives you the most faithful rendition of the video information. A setting of 0 gives you a highly pixelated rendition . Here, lower numbers translate into smaller files sizes for the published movie.

Scale. The Scale setting (0 to 100 percent) allows you to reduce the dimensions of the video clip. Spark always retains the original aspect ratio (ratio of width to height) of your video clip. Once again, smaller numbers equal smaller file sizes for your published movie.

Synchronize. Video and Flash animation are both frame-based media, but when the frame rate of an embedded video clip differs from the frame rate of the Flash movie containing it, you can wind up with a situation reminiscent of a goat and a giraffe trying to keep pace with one another: The goat must take several steps to the giraffe's one, or the giraffe must reduce its stride.

When you check the Synchronize . . . checkbox, Spark encodes the video in a way that forces Flash to always preserve the original duration of the embedded video clip. If, for example, you have a 10-second, 10-frames-per-second (fps) clip, with the Synchronize . . . setting, the video lasts 10 seconds, no matter what the Flash movie's frame rate is. In a 5-fps Flash movie, Flash drops enough frames of the video clip so that the clip still takes just 10 seconds to play. In a 20-fps Flash movie, Flash duplicates video-clip frames so that the clip still takes a full 10 seconds to play.

If you uncheck the Synchronize checkbox, the frames go in lock step, but you get to control how the steps interlock by selecting the ratio of video frames to Flash frames. In the Number of Video Frames to Encode per Number of Macromedia Flash Frames section, you can choose from seven different ratios (1:1, 1:2, 1:3, 1:4, 1:8, 2:3, and 3:4). Take a look at importing the 10-second, 10-fps clip; uncheck the Synchronize checkbox . . . and choose a frame-encoding ratio of 1:1 (one video frame for each Flash frame). Placed in a 5-fps Flash movie, the clip takes twice as long to play completely (20 seconds); in a 20-fps Flash movie, the clip takes just half as long (10 seconds).

Import Audio. If your video clip contains audio that's sampled at 44.100Hz, 22.050Hz, 11.025Hz, or 5.50125Hz, you can import the audio together with the video. (Note that Flash does not treat this audio as a sound symbol. You will not see its waveform in the Timeline, and you cannot control its streaming or playback as you learned to do with sounds earlier in this chapter.) You can also choose to import the video without its audio component. If the video clip contains audio sampled at a rate that's not supported, Flash warns you that you cannot import the audio track.

To import links to QuickTime video clips:

  1. Create the Flash document in which you want to place the linked video, and select the keyframe in which you want the video to start.

  2. From the File menu, choose Import or press graphics/01icon01.gif -R (Mac) or Ctrl-R (Windows). The standard file-import dialog box appears.

  3. From the Show pop-up menu (Mac) or the Files of Type pop-up menu (Windows), choose QuickTime Movie (Figure 14.44).

    The dialog box displays only QuickTime files.

    Figure 14.44. Choose QuickTime Movie from the Show (Mac) or Files of Type (Windows) pop-up menu in the Import dialog box to locate QuickTime files for import.

    graphics/14fig44.gif

  4. Navigate to a QuickTime file on your system, and select the file.

  5. Click Open.

    The Import Video dialog box appears.

  6. Under Import Options, choose Link to External Video File (Figure 14.45).

    Figure 14.45. The Import Video dialog box gives you the choice of linking a QuickTime video clip or embedding it.

    graphics/14fig45.gif

  7. Click OK.

    If the span for the selected keyframe contains fewer frames than the linked video clip, the Macromedia Flash warning dialog box appears, asking whether you want to add enough frames to display the entire linked clip (Figure 14.46).

    Figure 14.46. Flash can expand the selected keyframe span automatically to accommodate every frame in the video clip that you are importing.

    graphics/14fig46.gif

    What Video Formats Does Flash Accept?

    Flash imports Macromedia Flash Video Format (.flv) files directly. The .flv format is one created by Flash itself and by Sorenson Media's Squeeze codec. (Squeeze is the professional version of Spark and offers more features for manipulating and compressing your video.) To import other video formats, you will need to have a codec or a program that acts as a translator installed on your system. With QuickTime 4 (or a later version) installed on Windows and Macintosh, you can import .mov, .mpg, .mpeg, .dv, and .avi files. On the Windows platform, you can also use DirectX 7 (or a later version) to import .wmv, .asf, .mpg, .mpeg, and .avi files.

  8. To enlarge the keyframe span, click Yes. Flash adds enough frames to the span to reveal the entire video clip.

    or

    To retain the current number of frames in the keyframe span, click No. Flash truncates the video clip to fit in the existing frames. Flash adds the linked video clip to the active document's library and places an instance of the linked video clip on the Stage. The video frames appear on the Stage within the frames of the keyframe span.

    Flash identifies linked video clips by their own icon (a small movie camera with a chain link attached) in the library and lists them as Linked Video in the Kind column (Figure 14.47).

    Figure 14.47. The imported video clips live in the library of the active Flash document.

    graphics/14fig47.gif

graphics/01icon02.gif Tips

  • Tired of seeing that warning dialog about insufficient frames? Check the Don't Show Me This Message Again checkbox. Then click yes to have Flash always add sufficient frames to display the full video clip. Click no to have Flash truncate imported clips. To restore your choice in the matter, reset the preference for showing or skipping this warning in the Warnings tab of the Preferences dialog box. (Choose Edit > Preferences to access the dialog box.)

  • Even when you refuse to allow Flash to add frames when you place an instance of a video clip on the Stage, the full clip is there. You can add frames to the span later to reveal more of the video clip.

  • To import the video without placing an instance on the Stage, choose File > Import to Library.


To bring embedded video clips into a Flash movie:

  1. Follow steps 1 and 2 of the preceding exercise.

  2. From the Show pop-up menu (Mac) or the Files of Type pop-up menu (Windows), choose All Video Formats (Figure 14.48).

    Figure 14.48. To view all the video files available for import by Flash, choose All Video Formats from the Show (Mac) or Files of Type (Windows) pop-up menu in the Import dialog box.

    graphics/14fig48.gif

    Flash displays all the video files that you can import.

  3. Navigate to and select the video file on your system.

  4. Click Open.

    For QuickTime files, the Import Video dialog box appears. Under Import Options, choose Embed Video in Macromedia Flash Document, and click OK (Figure 14.49).

    The Import Video Settings dialog box appears.

    Figure 14.49. When you import QuickTime movies, you have the choice to import a link to the source file or to embed the video clip directly in Flash.

    graphics/14fig49.gif

    For all other types of video files, the Import Video Settings dialog box appears immediately (Figure 14.50). (To learn more about these settings, see the sidebar "The Mystery of Video-Import Settings" earlier in this chapter.)

    Figure 14.50. The Import Video Settings dialog box is your interface with the Sorenson Spark codec. Spark encodes and compresses the video file on import. Use the Import Video Settings to balance file size and quality.

    graphics/14fig50.gif

  5. To optimize compression for the video clip, do the following:

    • In the Quality field, enter a value between 0 and 100. The lower the number, the more pixelated the video will appear, but the smaller the published movie will be.

    • In the Keyframe Interval field, enter a value between 0 and 48. Higher values (that is, larger intervals between full video keyframes) translate to smaller file sizes for your published movie but lower quality in the video images.

    • In the Scale field, enter a value between 1 and 100 percent. Reducing the dimensions of the embedded video clip results in smaller file sizes for your published movie.

  6. To set synchronization between the video clip's frames and the Flash movie's frames, do one of the following:

    • To enable Flash to drop or add frames to the video to ensure that it retains its original duration during playback in Flash, check the Synchronize Video to Macromedia Flash Document Frame Rate checkbox.

    • To allow the playback time of the video clip to change, but to retain all of the clip's frames, deselect Synchronize Video to Macromedia Flash Document Frame Rate, and from the pop-up menu, choose a video-to-Flash frame-encoding ratio.

  7. To import an audio track (when one is available at a supported sampling rate), check the Import Audio checkbox.

  8. Click OK.

    The Importing dialog box appears, displaying a progress bar and a Stop button for canceling the import operation.

    If the span for the selected keyframe contains fewer frames than the embedded video clip, a warning dialog box appears, asking whether you want to add enough frames to display the entire clip.

  9. To enlarge the keyframe span, click Yes. Flash adds enough frames to the span to reveal the entire video clip.

    or

    To retain the current number of frames in the keyframe span, click No.

    Flash adds the embedded video clip to the active document's library and places an instance of it on the Stage. The video frames appear on the Stage within the frames of the keyframe span (Figure 14.51).

    Figure 14.51. Unlike movie clips, which display only their first frame in movie-editing mode, the changing frames of an imported video clip appear on the Stage in each frame of the span containing the clip.

    graphics/14fig51.gif

    Flash identifies embedded video clips with their own icon (a small movie camera) in the library and lists them as Embedded Video in the Kind column (Figure 14.52).

    Figure 14.52. Video-clip symbols bear their own identifying icon. Check the Kind column in the Library window to see whether the video is for linking or embedding.

    graphics/14fig52.gif

I l @ ve RuBoard


Macromedia Flash MX for Windows and Macintosh. Visual QuickStart Guide
Macromedia Flash MX 2004 for Windows and Macintosh (Visual QuickStart Guides)
ISBN: 0582851165
EAN: 2147483647
Year: 2002
Pages: 243

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net