Section 7.2. Converting Prerecorded Materialto FLV Format

7.2. Converting Prerecorded Materialto FLV Format

It's not very likely that all of the audio/video material you want to stream to your users was recorded by your FlashCom Server. Chances are, you'll have content that you've recorded with other higher-quality capture sources, such as a mini-DV camcorder or video output from 3D modeling applications. Your business clients may even provide you with high-quality video footage for movie trailers , sports or news clips, or product demonstrations . Most of these files are not going to be in a digital video format directly supported by FlashCom. For that reason, you'll need a way to convert disparate video formats to the FLV file format, the only one that FlashCom supports.

If you need some sample video content to convert to FLV files, you can download sample Windows AVI and QuickTime MOV files from the book's web site.


7.2.1. Recompressing Video Files

A sure sign of a less than ideal digital video workflow is the act of recompressing digital video files that have already been significantly compressed with some other encoder. For example, a business client of yours may provide you with Windows Media (WMV) files. Since FlashCom supports only the FLV file format, you'll need to convert the WMV files with one of the utilities discussed in this section. However, WMV files already have been compressed from some other source footage. It's likely that the WMV files already show signs of compression, such as artifacts (digital noise around the edges of video images). Applying yet another compressor such as Sorenson Spark to this footage will only introduce more artifacts. So you should always attempt to get the original source videotape (or transfer) and capture the video yourself in your preferred video editing application. Alternatively, ask your client to provide you with broadcast-quality digital video files.

7.2.2. Using Flash MX 2004 to Create FLV Files

You may already know that Flash MX and Flash MX 2004 enable you to import and embed digital video files into Flash movies (SWF files). But did you know that you can also reexport those embedded video files as FLV files that you can use with FlashCom Server? Admittedly, the Flash MX or Flash MX 2004 authoring environment can encode video only with the Sorenson Spark Basic edition codec (a.k.a. CBR encoding). Thus, the quality of video is significantly lower than that of the other tools we discuss in this section. The quality is good enough, though, if you just need a quick conversion of video formats to use in a FlashCom Server application.

If you have Flash Pro, you can use the included FLV Exporter tool with most QuickTime-enabled applications, including Apple QuickTime Player Pro. This utility is discussed in the next section.


The following tutorial provides an overview of the Video Import Wizard in Flash MX 2004. For more specific information on the options available in the Video Import Wizard, refer to the Help panel in Flash MX 2004.

To import a digital video file into a Flash MX 2004 document:

  1. Before you begin, make sure your Flash document is using the frame rate you want to use with the video clip from FlashCom. With a new Flash document (FLA file) open , choose Modify Document (Ctrl-J or Cmd-J). In the Frame Rate field, enter your desired frame rate. Most video delivered over the Internet uses a frame rate of 12, 15, or 24. Click OK to close the dialog box.

  2. Choose File Import Import to Library. In the Import to Library dialog box, browse to a digital video file that you want to encode in FLV format. Flash MX 2004 supports most popular video file formats, including QuickTime (MOV), Video for Windows (AVI), Windows Media (ASF, WMV), and MPEG files.

  3. After you have selected a digital file to import, the Video Import Wizard appears. The first screen of the wizard will vary according to the file format you chose. Figure 7-2 shows the first screen when a QuickTime file has been selected for import. If you want Flash MX 2004 to convert the file to the FLV format, choose the Embed Video in Macromedia Flash Document option and click the Next button.

Figure 7-2. The QuickTime import screen of the Video Import Wizard

  1. After you have selected the QuickTime embed option (or if you have selected a non-QuickTime file format in Step 2), the Video Import Wizard proceeds to the Editing phase. As shown in Figure 7-3, you can decide whether you want to import the entire video or choose various clips within the source footage to import. For the purposes of this exercise, choose the Import the Entire Video option, and click the Next button.

    Figure 7-3. The Editing screen of the Video Import Wizard

  2. Now you have reached the Encoding phase of the import process. On this screen, shown in Figure 7-4, you can choose the compression and filter options for the clip. You can choose a predefined compression profile for your desired bit rate, or you can create a custom profile by choosing Create New Profile from the Compression Profile drop-down menu. For the purposes of this exercise, choose the DSL/Cable 256 Kbps profile. If you click the adjacent Edit button, you can see the options for profiles and the specific settings for this preset on the Compression Settings screen, as shown in Figure 7-5. After you review these settings, click the Back button to return to the main Encoding screen. Select Create New Profile from the Advanced Settings drop-down menu. This brings up the Advanced Settings screen, as shown in Figure 7-6, where you can change color characteristics of the video image, scale and crop the video area, control how the clip is imported into the current timeline, and enable/disable the audio track of the video clip. Click the Back button to return to the main Encoding screen.

    Figure 7-4. The Encoding screen of the Video Import Wizard

    Figure 7-5. The Compression Settings used by the Video Import Wizard

    Figure 7-6. The Advanced Settings used by the Video Import Wizard

  3. Once you have determined the compression and filter settings for the clip, you're ready to let Flash MX 2004 encode the digital video file. In the Video Import Wizard, click the Finish button. As Flash encodes the video, a dialog box indicates the progress of the import as shown in Figure 7-7.

    Figure 7-7. The Importing progress dialog box

    To export the embedded video clip to an external FLV file:

  4. After the video clip has been imported into the Flash document, open the Library panel (Ctrl-L or Cmd-L). Right-click (or Ctrl-click on Mac) the Embedded Video symbol that represents the video file you imported and choose Properties as shown in Figure 7-8.

    Figure 7-8. The context menu for an Embedded Video symbol in the Library panel

  5. In the Embedded Video Properties dialog box, shown in Figure 7-9, click the Export button. In the Export FLV dialog box, specify the name of a new FLV file and click the Save button.

    Figure 7-9. The Embedded Video Properties dialog box

  6. Move the FLV file to the streams/_definst_ folder of your FlashCom application.

If your FlashCom applications folder doesn't have a streams subfolder, refer to "Configuring the FCS Application" later in this chapter. There, you will learn how to create the appropriate folders in which to store your FLV files.

7.2.3. Exporting Video from QuickTime Player Prowith the FLV Exporter

If you are using Flash Pro, your installation CD or downloaded installer files include a Flash_Video_Exporter.exe file (or Flash_Video_Exporter.dmg on Mac). Make sure that you have run this installer file before continuing with this section. This installer does not create a standalone application with which you can encode digital video files. Rather, it installs a QuickTime plugin that enables FLV export from most QuickTime-enabled applications.

In January 2004, Macromedia released Video Update 1.2 for Flash Pro. This updater improves the capabilities of the Flash Video Exporter. Among other features, the updater adds two-pass VBR encoding to the exporter's options and embeds the length of the video clip into the FLV file for use by the media components , discussed later in this chapter. You can obtain the updater from http://www.macromedia.com/support/flash/downloads.html.


A good indication that your preferred video editing application supports QuickTime is to check for a File Export Movie option. Usually, the Export Movie option of a video application enables you to output QuickTime files. Some video applications such as Adobe Premiere Pro 7 support QuickTime files but do not have a feature to export movies in various encoders like the FLV format.

In order to export FLV files from Apple QuickTime Player, you need to buy a registration key for the Pro version. You can find more details about QuickTime Pro at http://www.apple.com/quicktime/upgrade.

The primary difference between Flash Pro's Flash Video Exporter and the built-in Video Import Wizard of Flash MX 2004 is VBR encoding. The Video Import Wizard can compress video only with CBR encoding, while all of the other tools discussed in this chapter support VBR encoding. As you learned earlier, you can achieve better visual images and smaller file sizes if you use VBR encoding.

To export the video in FLV format from QuickTime Pro:

  1. Open the digital video file in QuickTime Pro.

  2. Optionally, drag the in and out markers (the small triangles below the progress bar, shown in Figure 7-10) to trim the clip. Be sure to choose Edit Trim after you have changed the markers' positions .

    Figure 7-10. Setting the in and out markers in QuickTime

  3. Choose QuickTime's File Export Movie command. In the Save Exported File As dialog box (Figure 7-11), choose Movie to Macromedia Flash Video (FLV) in the Export drop-down menu. Specify a location and filename for the new FLV file. Click the Options button in the dialog box to view and edit the compression settings to be applied by the Flash Video (FLV) Exporter, as shown in Figure 7-12.

    Figure 7-11. QuickTime's Save Exported File As dialog box

    Figure 7-12. The FLV Exporter settings for video and audio compression

    Unless you've got to be somewhere in a hurry, always use the Best (2 Pass) option for compressing your FLV files. The visual quality and file size are always better, compared to other compression options.


    After you have determined which compression settings you'd like to use, click the Save button to begin the export process. QuickTime shows the export progress in a dialog box. (We discuss appropriate settings throughout the remainder of the chapter.)

  4. When the FLV file has finished exporting, copy the file to the appropriate streams folder of your FlashCom application, as described under "Configuring the FCS Application" later in this chapter.

7.2.4. Optimizing Media with Sorenson Squeeze

One of the first products on the market to create FLV files was Sorenson Squeeze. Naturally, Sorenson would have an edge on the competition, given that they created the Spark codec. By far, Sorenson Squeeze gives you the most control over the subtleties of compression with the Spark Pro codec. You can also batch process several files with the same settings or even choose multiple output settings for the same file. For example, if you want to create FLV files for specific bit rates, you can add a new output setting for each bit rate you wish to create. You can also capture DV (Digital Video) footage directly from your Firewire-connected camcorder with Sorenson Squeeze. In this section, we provide you with an overview on the media creation process in Squeeze. To learn more about Sorenson Squeeze, visit http://www.sorenson.com.

Sorenson Squeeze is offered in two editions for Flash users: Sorenson Squeeze 4.0 for Flash MX (which, despite the name, is also appropriate for Flash MX 2004) and Sorenson Squeeze Compression 4.0 Suite. The Compression Suite enables you to compress video in several output formats, including MPEG-2 DVD video to Flash Video (FLV). The Macromedia Video Kit includes Sorenson Squeeze 4.0 Lite for Flash MX, which has a reduced feature set from Squeeze 4.0 for Flash MX. You can find a comparison of features at http://www.macromedia.com/software/studio/flashvideokit/sorenson_comparison.html.


The figures in this section depict the Compression Suite version, but the features discussed are available in both editions. While you can also use Squeeze to output Flash movies (SWF files), this section discusses only FLV output.

To export FLV files from Sorenson Squeeze 4.0:

  1. Open the Sorenson Squeeze application.

  2. Choose File Import Source (or click the Import File button in the Input panel), and browse to a location containing a digital video file.

  3. When the video clip opens in Squeeze (see Figure 7-13), you can preview the video clip and choose in and out points for the clips if you need to trim footage from the original clip. Squeeze 4.0 offers a new cropping tool, available directly in the preview window.

    Figure 7-13. Previewing a clip in Sorenson Squeeze

  4. If you want to adjust the image contrast or brightness or make other audio/video tweaks, you can use one of the presets available in the Filters panel (shown on the left in Figure 7-13) or create your own by choosing Filter New or clicking the plus (+) button in the toolbar of the Filters panel. As shown in Figure 7-14, the Filter dialog box provides image adjustment controls. Any changes to the Contrast, Brightness, Gamma, White Restore, Black Restore, or Cropping values update the video clip image in the preview window of the main application interface. You can control the video clip's current position while you edit the image adjustment values. While most of these filters' effects can be previewed immediately, the benefits of some filter settings cannot be appreciated until you have actually compressed the clip:

  5. Video Noise Reduction

    This setting can be used to eliminate grainy looking video. Video noise is usually found in footage shot in low light, with an inexpensive mini-DV camcorder or footage transferred from VHS tape. As a rule of thumb, use the Light setting for footage captured from a low-end mini-DV camcorder (i.e., a single-chip or CCD camcorder) and use the Heavy setting for VHS transferred footage.

  6. Normalize Audio

    When selected, option analyzes the audio track of the video clip and looks for the highest audio level. If that audio level is very low, Squeeze will amplify it to a "normal" level and adjust the rest of the audio track accordingly . For example, if your DV camcorder's microphone was pointing at a person lecturing from a podium and that person's voice wasn't very loud (relative to the microphone's position), normalizing the audio can increase the volume so that it's more audible. However, normalization usually increases background noise and silence in audio gaps as well.

    Figure 7-14. The filter settings in Sorenson Squeeze

  7. If you created a custom filter, select Custom in the Filters panel and click the Apply button. The selected filter is now added to the current clip in the Job list below the video preview area, as shown in Figure 7-13.

  8. Now you're ready to select the output format. Expand the Macromedia Flash Video ( .flv ) listing in the Format & Compression Settings panel, as shown in Figure 7-15. Choose the bit rate settings for your target audience; you can Shift- or Ctrl-click as many bit rate settings as you require. For footage that you want to use with FlashCom Server, start with one of the bit rates ending with the _Stream suffix. For this example, we selected the 256K_Stream option. After you have selected a bit rate, click the Apply button. The output setting appears below the clip name in the Job list, as shown in Figure 7-16.

    Figure 7-15. The bit rate options in the Macromedia Flash Video (.flv) category in the Format & Compression Settings panel

    Figure 7-16. The output settings in the Job list

  9. You can use the default compression settings that Squeeze has predefined in the output profile, or you can adjust the settings to suit your tastes. Click the + button next to 256K_Stream in the Job list, and you will see the expanded output setting shown in Figure 7-17. Double-click either the MP3 or Spark Pro list item. Double-clicking either opens the Audio/Video Compression Settings dialog box shown in Figure 7-18. Again, while the VBR compression process takes longer than CBR, you'll get better visual quality in your video clip if you choose Sorenson 2-Pass VBR in the Method combo box, located in the Video section of this dialog box. Among other compression options, you can also provide Squeeze with a file size limit (in the Constrain File Size field). If your desired compression settings exceed this limit, Squeeze will reduce the quality to meet your file size expectations.

    Figure 7-17. Change the compression settings of your clip by expanding the output setting and double-clicking the MP3 or Spark Pro entry

    Figure 7-18. Squeeze's Audio/Video Compression Settings dialog box

  10. Once you have finessed the output settings, you're ready to let Squeeze do its job. Click the Squeeze It! button, as seen in Figure 7-17, and Squeeze starts to analyze the video clip and compress it in FLV format. The resulting FLV file is located in the same directory as your original video clip, unless you specified a different output location. You can change the output location by selecting the output setting in the Job list and choosing Batch Change Destination. You can also right-click (or Ctrl-click on Mac) the output setting and choose Change Destination.

  11. After Squeeze has finished creating the FLV file, copy the FLV file to the appropriate streams folder of your FlashCom application.

If you want to compress two or more source video clips in a batch, you can continue to import more source files using File Import Source or clicking the Import File button. Select the new clip in the Job list, and choose your filter and compression options. Repeat the process for each additional source clip. You can also select multiple output settings for each individual clip. When you have all of your source clips and output settings configured, click Squeeze It! to begin processing the batch.

Using Watch Folders in Sorenson Squeeze to Create Streams

One of the great features of Sorenson Squeeze is its capability to batch compress several video clips in the same location. Moreover, Squeeze will continue to monitor that folder for new video clips and compress them automatically. The process to batch compress and/or set up a watch folder is nearly the same as the steps outlined in the previous section:

Move all of your video clips to the same folder location (such as C:\video_compress ).

In Sorenson Squeeze, choose File Watch Folder (or click the Watch Folder button), and select the location you used in Step 1. The video preview area will not display any video footage, but the Job list will list the folder's name.

Proceed to choose output file format(s), filter settings, and compression options.

After you choose a compression option, the Job list displays the option's information. Note that the output filename includes the compression setting name as a suffix that will be added to each source video clip's filename. For example, if you choose the 256K_Stream preset, a source clip named snail .mov will have a counterpart output filename of snail256K_Stream001.flv .

Click the Squeeze It! button, and Squeeze will begin compressing the files in the folder location. At this point, Squeeze creates two subfolders in the watch folder location: CompletedSource and CompressedOutput . After Squeeze has finished compressing a source clip in the watch folder location, it moves the source clip to the CompletedSource folder. The compressed FLV file for each source clip is created in the CompressedOutput folder.

After Squeeze has finished compressing the original source clips in the watch folder location, it continues to monitor the folder for new source clips as long as the Squeeze application runs. As new clips are added, Squeeze creates new output files with the compression options you specified earlier.

You can create a virtual directory in your FlashCom virtual host settings that is mapped to the CompressedOutput folder of the watch folder, or you can create a script that moves the compressed files to another location. For example, you could move the compressed files using the <cfschedule> tag in a ColdFusion page. In this way, you can stream new files from FlashCom applications without additional intervention.


7.2.5. Creating Media with Wildform Flix Pro

You can also encode FLV files with Wildform Flix Pro. Nearly all of the features in Sorenson Squeeze 4.0 are available in Flix Pro 4.0. Flix Pro does not have a watch folder as Squeeze does (see the sidebar), but Flix can batch process files with a few extra filenaming options. Flix Pro version 4.0 is currently available only for Windows; the latest Macintosh version is 3.0.

Flix can also create vector versions of your digital video source clips, as Flash movies (SWF files). These movies cannot be streamed from a FlashCom application, but they can be used to create frame-by-frame masks for Flash video. To see a sample of vector output from Flix, go to http://www.wildform.com/resources/gallery_vv.php.


To export an FLV file from Flix Pro 4.0:

  1. When you start Flix Pro 4.0, the File tab, as shown in Figure 7-19, is visible. Click the Browse button to the right of the Input setting to select a source clip. Flix will automatically assign an output file in the same location, with the file extension of the output format you are using. such as .flv or .swf . By default, Flix assumes you are outputting to a .swf file, so change it to .flv .

    Figure 7-19. The File tab of Wildform Flix Pro 4.0

  2. Choose a compression profile in the Preset drop-down menu. For this example, choose the 300K Broadband Video (MX FLV) profile, as shown in Figure 7-20.

    Figure 7-20. The Preset menu options

  3. If necessary, click and drag the in and out pointers below the video preview area. The selected range is shaded blue (which appears gray in Figure 7-21).

    Figure 7-21. The markers below the video preview area control the in and out points

  4. Click the Video Filters button in the lower right corner of the File tab. The Editor dialog box (shown in Figure 7-22) offers similar options to the filter settings of Sorenson Squeeze. Unlike Squeeze, though, you can finesse the video noise reduction with a precise numeric slider. You can also boost saturation values; NTSC video (the video signal recorded to DV camcorder tape) often appears less saturated when viewed on a computer monitor compared to a standard TV screen. You can use the Saturation slider to revive footage that looks washed out. Or you can remove all saturation to create black-and-white (grayscale) video. You can also check the Deinterlace option to remove the flicker from NTSC video footage shot with North American camcorders. While Sorenson Squeeze will automatically detect that your footage is interlaced, you need to let Flix know if you want your footage deinterlaced.

    Figure 7-22. The Flix Pro Editor dialog box

  5. If you'd like to finesse the video and audio compression settings for your chosen preset, click the Vid/Aud tab (shown in Figure 7-23). One of the nice features of Flix is that the original source (or input) clip's information is juxtaposed next to your output clip settings. You can easily determine whether you're specifying an output dimension or audio sampling rate that exceeds the originalgenerally, you do not want to upsample video or audio quality in your output file.

    Figure 7-23. The Flix Pro Vid/Aud tab

  6. Now you're ready to output the FLV file. Select the File tab and click the Encode button to the right of the Preset option, as seen in Figure 7-21. Flix opens an Encoding dialog box (as seen in Figure 7-24) enabling you to monitor the bit rate settings during analysis and compression.

    Figure 7-24. The Flix Pro Encoding dialog box

  7. When Flix has finished the encoding process, a preview window appears and plays the FLV file. If you missed the playback of the preview, you can replay the FLV file by clicking the Play button to the right of the Output setting of the File tab.

  8. Copy the FLV file to the appropriate streams folder of your FlashCom application.

If you want to encode several source clips with the same preset, choose Edit Batch Process to select the clips.

For an open source solution to FLV compression, try ffmpeg , which uses libraries of audio and video codecs to transcode digital audio and video formats. FLV is among the many formats that the tool recognizes. The ffmpeg utility can also capture and create live streams. For more information on this handy utility, visit http://ffmpeg. sourceforge .net. For more information on open source programming in general, go to http://opensource.org.




Programming Flash Communication Server
Programming Flash Communication Server
ISBN: 0596005040
EAN: 2147483647
Year: 2003
Pages: 203

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