Now that you have imported some audio into the FLA file, it's time to switch gears and add some video to a FLA file. Flash 8 Basic allows you not only to import and embed video but also to do some very simple edits to the video as you import it. You can edit the single video file into several smaller clips if you like or bring the whole thing in without editing. Either way, you have a lot of control over the compression (or export) settings for the video.
A critical thing to consider before you import video is how much control you have over editing and compression prior to or during import. The more control you have typically means the better compression you can manage to achieve while still balancing file size with an acceptable quality. However, even with adequate control over compression (and a good codec), video can still be very large because of the amount of data contained in every single frame. Consider the following points about video before you start to edit or compress it:
Trim your video. Remember that blank areas at the beginning and end of the footage add to the file size, so make sure that you use Flash's editing features during the Video Import Wizard (used in the following exercises) to trim off any extra video at the beginning and end if you haven't already trimmed it prior to import.
Test your settings. If file size is very important, you should try out different import settings and quality levels. All video footage is different; it compresses and decompresses differently, depending on factors such as color, movement, and effects. If your video looks great when you import it, try changing the settings and compress the original file a bit more (perhaps by using a lower-quality setting or fewer video keyframes). It might still look great, but can end up importing with a smaller file size.
Limit fading, noise, and movement if possible. Fading includes fading in and out and also refers to one clip of video fading into another (known as cross-fadingsomething you might use if you have edited your video in another program). Noise refers to the speckles over each frame you might see if your footage is dimly lit, and movement (such as a tree blowing in the wind) similarly involves a lot of pixels moving. All these factors usually mean that the footage will be a larger file size. Two video clips that are the same frame size and lengthand taken with the same cameracan be a different file size depending on these factors. The footage is also difficult to compress, usually meaning that you need to use more keyframes and a higher-quality setting.
If you cannot avoid using fades or movement, or are having a lot of noise in your footage, remember to add more video keyframes when you compress the clip (you'll notice a setting for keyframes when you work with compression later on). The more keyframes you add, the better appearance your video has. However, the clip will also be a larger file size after it's compressed.
Avoid recompressing video that has already been compressed. Every time you recompress your video, more artifacting occurs, and the quality decreases. Artifacting means you will see blocks and pixilation in the video, which looks bad and of low quality. Because your original footage is already compressed, it probably contains "residue" of blockiness, so this throws off the second compression, the quality level decreases, and more of this blockiness occurs. Always try to compress from a video file with the least amount of compression.
When you are working with video on a Timeline, remember that it is different from a Flash Timeline. If you're working with normal video imported directly into Flash, you cannot add code or keyframes within the video itself (although you can insert the video into a movie clip and add ActionScript to that).
For this exercise, you will import a video that you will use for the Tour page of the Tech Bookstore site. Following this exercise, you need to import a few other videos, so you will need to revisit this exercise when you do so (unless you remember all the steps!).
Create a new file called video1.fla and save it in your TechBookstore folder on your hard drive. Change the Stage Size to 320 x 179.
You will embed videos into Flash and then publish them. In a later lesson, you will dynamically load the SWF files that you are producing, so you want the Stage size and the video dimensions to match. 320 wide by 179 high are the width and height of the MOV files you will import.
Find video1.mov in the lesson07/assets folder on this book's CD-ROM and copy the file into your TechBookstore folder on your hard drive. Change the fps to 15 in video1.fla.
You must have QuickTime 4 or greater on the Mac or DirectX 7 or greater on the PC to import video. Choose video1.mov from the lesson07/assets folder on the CD-ROM and copy it to your hard drive.
This video file does not have any audio. You can expect to see a warning or alert in relation to this. You will be using the audio that was imported earlier to go along with the video files. If you were to import a video with sound, you could not hear it when working with your document in the authoring environment. You could hear it only when you test your document or publish the SWF file. Change the fps setting for video1.fla to 15 using the Property inspector.
Choose File > Import > Import Video and find video1.mov on your hard drive. The Select Video section enables you to import a video file already on your computer or point to a video file already uploaded to a web server. The dialog box is more or less a wizard that, once you've chosen an import option, presents you with different steps and different choices to make about how you want to use video at each point. You will actually physically import video to the document Timeline, which embeds it in the final SWF file.
When you open the Import Video dialog box, you are placed in the Select Video section.
This book does not treat the FLV format, because the book covers only Flash 8 Basic. Flash 8 Professional contains many components that are specifically designed to work with the FLV format for video. Press the Choose button in the Import Video dialog box, select video1.mov on your hard drive in the Import Video dialog box, and then click Open. Press the Continue button to move to the next option.
Choose to embed the video file in the Flash document and then click Continue. You have the choice to embed, progressively download, stream, or link the video to the SWF file you export. If you embed the file, you can edit the video and manipulate it with ActionScript or add buttons that can be used to control the video. When you are finished, click the Continue button.
After you have selected how to bring in your video, you are brought to the Deployment section, which allows you to choose how you will deliver the video file.
You can also dynamically load FLV files into Flash when your SWF file runs, so you do not need to embed the file in the SWF file. Instead, you can use ActionScript to load it into the SWF file when an event occurs (such as a visitor clicking a button). You can then use ActionScript or other controls to manipulate the video file. This capability is covered in other books from the Training from the Source series.
Select the Embed the Entire Video radio button and then press Next. At this point, you can progress directly to compressing and importing the entire video or you can edit the video first. Editing the video allows you to create smaller video clips from a large video, which is incredibly useful. This means that you do not necessarily need to import the entire video and you can drop the footage you don't need and save on some file size.
The section after deployment is Embedding. Here, you choose how you want your embedded video to be treated within the Flash 8 document. You can choose to treat the embedded video as either a movie clip symbol or a graphic symbol, or just leave it as embedded video. You can also choose to place an instance of the video on the Stage by default. If you deselect that option, be more selective about where the video will be placed within the document.
In most circumstances, it is more sensible to edit the video before it is imported into Flash with a proper video editor because Flash video editing really is about trimming the video down into smaller pieces. You won't always have that option, though, so don't forget about this feature, even though you don't use it in the book. In the next exercise, you will look at Flash 8 Basic encoding settings, which control the file size of the video when it is imported, as well as its quality. Leave the wizard open because you aren't done yet!