Video Optimization

Before you decide to shoot some video that you intend to use on the computer, there are some things you should know that will help you make your video look as good as possible.

Media creation can be described as a war against unnecessary noise in your content. The more noise, the less your content can be compressed, the harder it is to stream to an audience. Follow these tips to produce high-quality video:

  • Minimize camera motion with a tripod

  • Minimize subject motion

  • Use a lot of light

  • Use a simple background

  • Avoid camera pans and zooms

  • Use professional equipment

  • Use a digital format

Carefully shooting and editing video for streaming or downloading can substantially improve the final quality of your video. Remember that the overall goal in producing video that encodes well is to create the highest-quality video with the least amount of noise, camera movement, and fine detail. This helps the source encode as efficiently as possible and look good at smaller image sizes. In order to create a good video source, you should use a high-quality camera, light the subjects well, and stabilize the camera with a tripod as much as possible.

Avoid handheld shooting whenever you can. If you need to film a handheld shot, a motion stabilizer such as a Steadi-cam or gyroscopic system like Kenyon Lab's (http://www.ken-lab.com) will help your results. If your camera has an image stabilization option (either optical or digital), use it to reduce subtle changes between frames caused by camera motion.

Keeping the detail within the scene to a minimum will help the individual frames of video compress more easily, giving you better results than video with lots of detail. It will also make the video easier to see when the movie is reduced in size for delivery. Trees often are used as backdrops for interviews filmed outside. The detail of the leaves poses a challenge for encoding and should always be avoided. If you must shoot against a background that uses trees, using a shallow depth of field to blur the leaves will often improve the final movie. Beware of trees moving in a breeze the high detail and subtle changes between frames make both temporal and spatial compression difficult. Ask your subjects to wear clothes that don't have high contrast patterns or lots of detail. Plain colors are best.

Equipment

A common misconception is that because the final movie will end up as a small part of the computer screen, a cheaper camera won't make a difference in the process. This is completely wrong. Video noise substantially degrades the encoding process, which means that a clean video signal produced by a high-quality camera will encode much better than a noisy signal produced by a low-quality camera. Also, the resolution and sharpness of the camera has a significant effect on the final stream quality.

Some miniDV cameras offer a progressive scan feature. This records each frame as a single "non-interlaced" image instead of two separate interlaced fields. Progressive scan source material may not play as smoothly on a television monitor as interlaced material, but it is superior for streaming because it contains no interlacing artifacts. You should look for this feature when buying a miniDV camera and use it when creating streaming content.

You can find a wide range of available miniDV cameras. Lower-priced cameras generally have a single CCD, smaller optics, and fewer features. Higher-quality miniDV cameras offer as many as three CCDs, higher-quality optics, image stabilization, and many other features to deliver superior image quality. If you don't currently own a camera, I would recommend you get a miniDV camera.

The analog formats (S-VHS, VHS, Hi8) produce noisier signals and lower-resolution video than miniDV. Because these formats are analog, you need either an analog-to-FireWire converter or an analog-compatible video capture system to make them work on your computer.

Professional formats generally produce the highest-quality results and often work with green- and blue-screen better than the other types of cameras. However, these professional formats are very expensive. In order to work with a pro format on your computer, you'll need to use a video system that is capable of handling the formats, such as a Media 100 or Avid system.

Lighting

Generally speaking, video that is well lit encodes better than under- or over-exposed material. Adequate lighting is critical to creating superior streaming movies because low light conditions also produce excessively noisy video signals that lack detail in the shadows. Overexposure is usually less of a problem but should also be avoided.

Don't shoot video that you know is exposed incorrectly and then plan on fixing it in your computer. Missing detail and excessive noise can never be fully corrected. Properly lighting your video is the only way to ensure the highest-quality results.

Because lighting is an art form all in its own, I recommend that you get a book or two on the subject of lighting for video or film. I recommend Learning to Light by Roger Hicks and Frances Schultz (Amphoto, 1998).

There are spotlights , umbrella lights, three point lighting, tungsten lights, and fluorescent, just to name a few. Each type of light has a different "temperature" and a different white-point associated to them. You will need to learn about this and many other aspects of proper lighting if you plan on doing this professionally.

Capturing

In order to edit video on your computer, you must first get it onto your hard drive. This is called capturing the video, or digitizing.

If you shot your video with a miniDV camera, you can simply transfer the video to your computer via the camera's IEEE 1394 port, also called FireWire or iLink. This results in very high-quality source video because there is no analog-to-digital conversion when capturing.

If you did not use a miniDV to capture your material, you have two options for digitizing it. You can use a converter to transform the analog signal to a digital signal and then capture. Or you can capture your analog video with an analog video capture card or a system that can handle analog signals such as a Media 100i, Avid, or other capable system. Both technologies provide the same quality level.

Analog

If you are using an analog video system, you can do several things to improve the quality of the video.

To get the highest-quality results, capture your analog video at full-screen resolutionthat is, 640x480 (NTSC) or 720x486 (miniDV)depending on the native resolution of your source. Even if you intend to deliver smaller final movies, a full-screen capture will generally give you better results for a number of reasons. For example, capturing at full screen and scaling down the image tends to reduce video noise and results in a smoother-looking image. Because the noise is reduced, the video clip tends to compress better than the non-scaled-down clip.

Most captured video has a black border around the perimeter. This is often called overscanning or edge blanking; you must remove these edges. Starting from a larger image allows you to crop and then scale down the image. If you capture only at the final size you want to use to deliver your video, removing edge noise requires you to crop and then scale up the video, which degrades image quality.

The biggest problem while capturing video is missing or "dropped" frames. The most common cause of dropped frames is trying to capture your video at a higher data rate than your hard drive can support. As it falls behind, the capture starts to lose frames. Dropped frames often occur sporadically in the captured video, causing the video to randomly stutter or jerk.

For this reason, capture at the maximum quality your system can properly handle. (This should normally be at least 3 MB/sec.) If you can't capture at a very high-quality setting, consider buying a faster hard drive.

Configure your capture system to warn you of dropped frames and to stop capturing if they occur. To avoid dropped frames, you may need to defragment your hard drive, buy a faster hard drive or a RAID system, or lower the quality of your capture.

Digital (IEEE 1394)

Ah, the IEEE 1394 standardby far the easiest way for you to get your content into the computer. The IEEE 1394 standard (or FireWire, as it's branded) is a connection that most newer Macintosh and Windows computers have. The connection allows you to simply plug in your miniDV camera or deck, and the computer will not only control the device from the cable but will also transfer high-quality audio and video to your computer.

An example of this is Final Cut Pro for the Macintosh (see Figure 13.7). Final Cut Pro allows you to connect to your deck or camera, control its functions from the screen, digitize the entire tape (or sections of it), and then edit that content and finally put it back out to tape.

Figure 13.7. Apple's Final Cut Pro software for the Macintosh is a one-stop solution to digitizing and editing your video.
graphics/13fig07.gif

Optimizing Video After You Capture It

After capturing your source material, edit it as needed, adding any titles and effects you want to use. After that, you can, and probably should, optimize your source content. Here are some tips professionals use to create high-quality source content for encoding and streaming:

  • Crop the fuzzy edges

  • Reduce video noise (with filters)

  • Adjust contrast

  • Adjust gamma level (for cross-platform viewing)

  • Restore black and white

  • Deinterlace

Aspect Correction

Some formats, such as miniDV, do not have square pixels and must be corrected to look normal on a computer screen. In some cases, you may want to manually set a specific aspect ratio correction to compensate for unusual source material. Applications such as Cleaner will allow you to do this.

To produce the highest-quality file, you need to crop your video. Cropping allows you to specify which part of the image you want to keep in your file and is useful for eliminating the black edges around the video. For cropping details, consult your video program's manual.

Pixel Aspect Ratio

Normal pixels in the graphics world are square. A 50-pixel vertical line is the same length as a 50-pixel horizontal line on a computer monitor.

Pixels in some video signals are non-square. A 50-pixel vertical line may be longer or shorter than a 50-pixel horizontal line on a video monitor, depending on the video standard. The term that describes this is the pixel aspect ratio. It is specified as a fraction of vertical (y) pixel size divided by (x) horizontal pixel size. The pixel aspect ratio for square pixels is 1/1.

This term is different than frame aspect ratio, which is a fraction of total vertical (y) frame size over total horizontal (x) frame size, for a given definition of "frame." Typical frame aspect ratios for video are 4/3 and 16/9.

You may be wondering why this matters. Well, many image-processing operations assume a certain pixel aspect ratio. For example, a blur operation may look bad on non-square pixels. For this reason, any rendering of geometry-based graphics to an image must take the pixel aspect ratio into account.

The miniDV format is an example of a non-square pixel format. In general, this is just something that you need to be aware of; there is nothing you need to do to your video to make it non-square. Just understand that what you are looking at on your computer screen isn't the way it will look on a TV screen. Because of this, many professional video editors also have TV monitors hooked to their computers.

If you digitize video from a miniDV source but plan to show that video only on a computer or the Internet, you will need to compress the video by adjusting the pixel aspect ratio so that it is 1/1. The adjustment is done during the encoding process.

When you are using Cleaner to make a QuickTime, RealMedia, or Windows Media Player file, Cleaner can automatically make aspect ratio adjustments for you (see Figure 13.8). This is a great way to get an idea of what your video will look like after it's compressed.

Figure 13.8. Cleaner lets you make aspect ratio adjustments to your video.
graphics/13fig08.gif

Video Compression

Now that your video has been edited, look at the file size of the clip. How will you ever be able to put it on the Internet, or even burn it onto a CD? This is where a compression tool like Cleaner comes in handy.

Compressing Video for the Web

Video files on a hard drive are usually enormous . For example, just one minute of uncompressed video takes up 1.5 GB of storage. Luckily, most video recorders automatically compress captured video at a ratio of about 5:1. However, this compression still leaves the video file too large to distribute over the Internet

Always keep your target audience in mind. Will your viewers be using 56K modems, or will they be using T-1 lines? Whichever you choose, don't forget these two concepts:

  • The higher the data rate, the better quality the video.

  • Choose your compression settings with the slowest connection in mind.

Another decision you have to make is whether to stream your video or make it available through progressive download.

Streaming keeps your computer in constant contact with the server running the movie. Video data is transferred, displayed, and then optionally discarded once it has been seen. If the end user 's connection is too slow or the network experiences congestion, the data transfer rate may be reduced in order to preserve the best real-time playback possible. This type of media delivery is best suited to video clips more than a few minutes in length.

Compress Only Once

Video editing programs normally compress video by default during export. I recommend that you turn off any compression when exporting video by setting the compressor option to None. Although the file output will be larger to begin with, it will look much better when it is compressed only once.

Progressive download works by downloading the entire video to your hard disk. When you use the "fast start" option, after enough of the file has been transferred, the video starts playing automatically. Because of these limitations, progressive download is best for high-quality, relatively short video clips at a maximum of two to three minutes, and it offers better-quality video at low bandwidths than does streaming.

QuickTime Compression

In terms of compression, QuickTime has lots of options. When you double-click on any QuickTime movie (if you have the Pro version of QuickTime installed), you can compress your movie with many different choices. The video and/or audio data can be compressed (using codecs) into any format, but regardless of the compression codec that you use, you're still using the QuickTime format to "contain" and deliver the data.

Even though the Pro version of QuickTime allows you to compress your video right from the basic player application, if you are doing any serious work, you will need a compression application such as Discreet's Cleaner. You need Cleaner because some codecs have extended features that Cleaner allows you to access more easily. For example, the best video compression codec for web delivery is Sorenson Video 3 Pro; it has tons of features that Cleaner presents to you in a nice, easy-to-use interface (see Figure 13.9).

Figure 13.9. The Sorenson interface in Cleaner is simple and elegant.
graphics/13fig09.gif

Here are the keys you need to remember when you use Sorenson:

  • Sorenson is designed to make your video as small as possible, so when you are picking a data rate setting, start by using the width * height * FPS / 35000 formula.

  • Always use 2-pass VBR. It's the reason you buy Sorenson and what makes it work so well.

  • Don't set a "peak." Trying to figure it out is a waste of time; besides, the video will be small anyway.

  • Don't use "compare uncompressed frames." That setting is for computer animation type data.

  • Start with a multiple of 10 times your FPS as your keyframe setting. For example, 15FPS = keyframes every 150 frames.

You can learn more about Sorenson at their web site http://www.sorenson.com.

RealMedia Compression

To compress RealMedia, you need either Cleaner or the RealMedia encoding software, which you can get from the real.com web site. Regardless of which application you choose to use, your thinking process will have to be the same. You need to compress your video so that it looks as good as possible but is also as small as possible. You also have the option to use a RealMedia Export plug-in, such as the one for Premiere. It can produce perfect results with very little effort on your part. Just make sure to use the two-pass VBR option so that the codec can analyze your video before attempting to compress it. Also, if you can get away with it, lower your frames per second from 15 (the default) to 10, and then use that extra file-size savings to increasing image quality.

This tricky compression-versus-quality tradeoff is something that you will have to play with on your own because every piece of video needs different compression settings.

Flash Optimization

Due to its vector format, Macromedia Flash can create rich movies while keeping file sizes reasonable. Flash movies can also stream over the web. You can choose to have parts of your movie, or the entire movie, preloaded into a user's machine for smoother playback. As you've discovered on the web, however, Flash movies can get pretty large.

Optimizing Flash is a matter of using the right primitives and design techniques, optimizing ActionScript, and having the right compression and optimization tools. However, compressing sound and images within Flash is not ideal. It is much better to do all of your sound/image optimization in external programs that specialize in compression, and then import them into Flash. Flash MX offers improved media compression features, however, so be sure to work with the latest version.

Like other technologies, you can trade off playback optimization (smoothness) with file-size optimization (bytes transferred). Designers will always struggle with the two in Flash because files that load quickly can take up a lot of processing power, so they playback slowly. Yet files that download more slowly can play quickly in Flash presentations.

The best aid for playback is, of course, keeping the file size small. Here are a few design tips to help you tune your movies to keep their file sizes as small as possible:

  • Audio For audio, the best overall compression codec within Flash is MP3. MP3 offers superb quality for both voice and music and allows you to set the bit rate.

  • Bit rates The bit rate setting is where you make that quality-versus-size decision. Generally, 32Kbps is fine for a person talking and 56Kbps is good for music. If you need excellent music quality, you can go as high as 80Kbps, but remember that this is 80K per second that needs to download. The higher the bit rate you choose, the larger the file size of the Flash movie. For best results, optimize any images and audio beforehand and import them into Flash.

  • Images versus symbols Most of the size reduction you'll realize in all versions of Flash come from drawing symbols within Flash. Importing bitmapped images is always larger than drawing within this vector-based program.

  • Reuse symbols When you create a movie with multiple instances of the same object, convert the object into a symbol. Ten instances of a symbol take up just a little more file size than one instance of the symbol. The file size would be increased for each object, if the objects were not symbols.

  • Compression With Flash 4 and 5, you can reduce the size of your SWFs by 50 percent, using Generator. With MX, however, Macromedia added a compression scheme to the version 6 plug-in that gives nearly a 50-percent reduction in file size.

  • Minimize fonts Keep the number of fonts to a minimum. As is true with most development programs, when you increase the number of fonts used, you increase the size of your file.

  • Test early and often The only way to be sure your movies are loading properly is to test them in different browsers and connection speeds.

  • Use your artwork efficiently Try to discard any redundant or superfluous artwork. Lines drawn with the pencil take up less space than brush strokes. Familiarize yourself with the smooth, straighten, and optimize curves options. By optimizing curves, you will reduce the size of the movie.

  • Don't go overboard on animation Animation eats up processing power and that can slow down the playback of your movie. Remember that tweened animations are computed, so keep to a minimum the number of computations the Flash movie has to do simultaneously . If you have to do animations, try to use tweens instead of frame-by-frame animations, because tweened animations take up far less file size than the same animation in a bunch of keyframes.

After optimizing your movie, you can have Flash generate a file size report for your movie. Before publishing the movie, choose File > Publish > Settings, click the Flash tab, and click Generate size report.

When you publish the movie, Flash will generate a separate text file that contains different information about the size of your file.

Programming and Optimization Tips

Regardless of the version of Flash you use, you can benefit from learning some simple programming tips to help you speed up your movies.

First, scripts are always executed from the beginning to the end, and no event or gotoAndPlay() script will interrupt execution of other code. This is why any large for-loop will cause the Flash player to crash or hang.

If you are serious about writing Flash applications that run as fast as possible, you might want to consider using Flash 4 instead of using Flash 5 or even MX. Flash 4's style of coding is faster, including math functions, algorithms, arrays, and movieclip methods . Use that version whenever possible.

Here are some additional tips to help speed up your movies:

  • Keep all scripts less than 64KB (compiled) per frame.

  • Use tellTarget instead of with where possible.

  • Define local variables in functions with the var keyword. Local variables are faster (and using them is considered good practice).

  • Choose short names for variables.

  • Use a[a.length] = 5 instead of a.push(5) .

  • Replace suboptimal built-in functions with prototype.

NOTE: To help make your code faster, always work with objects using Flash 4 syntaxfor example, ../:myVar not _parent.myVar .

Figuring out all the things in Flash that can cause slowdowns isn't easy. Math functions, especially floating-point operations, perform well in general. There are cases, however, where simply using tellTarget("themovie") gotoAndStop() is considerably faster than themovie.gotoAndStop() .

Because identifier length matters, choose short names for variables. To try and save more space, you can extend this practice to functions also. Keep in mind that unlike JavaScript, some Flash functions are not optimal. You can replace slower functions with faster ones using the prototype method.

See Chapter 10, "Optimizing JavaScript for Execution Speed," for more details on Flash ActionScript optimization.

Flash Optimization Tools

Here are some excellent Flash optimization tools:

  • Flasm Free server application that allows fine-tuning of byte-level code. Also includes information on refactoring and Flash optimization (http://flasm. sourceforge .net/).

  • Optimaze Commercial application to optimize Flash movies (http://www.optimaze.us).

Shockwave Optimization

Optimization of a Shockwave file is done in the creation application Director. When Director imports bitmapped images, they are stored as cast members. These bitmapped cast members are where you can find the most file-size savings. Generally, Director will import your images in the bit depth to which your monitor is currently set. This isn't always the best solution, and you will have to re-adjust your images inside either the paint window or the cast window. Here's how:

  • When you save an image from Photoshop and import it into Director, the image will come in as either 16- or 32-bit. In most cases, that is way too much data per pixel and will seriously inflate your final .DXR (Shockwave) file size.

  • To reduce the size, reduce the number of colors. Either double-click on your cast-member to open the paint window or press Command+5 (Ctrl-5 on PC) on the keyboard.

  • Notice the color depth indicator in the lower-left corner of the paint window. It should show 16 or 32 bits. Double-clicking on this indicator will bring up the Color Depth Setting window, and you can choose the desired color depth from a pop-up menu.

Here a few things to remember about adjusting your color depth. If you have a 32-bit image and you take it down to 16 and then decide to take it to 8, you should start over and go directly from 32 to 8. Each step from one bit-depth setting to the other can introduce noise in your image.

Remember that you have to do this for all of your bitmapped images. Multimedia work done well is a time-consuming process, but professionals can spot amateur work a mile away. A 500KB Shockwave movie with a few moving images and a "click" sound can easily be reduced to 50KB if you spend the time to do it right.

Now that I've scared you a bit, let me give you a little tip that will help speed up your bitmap conversion process. If you decide that all your images can be dithered to 8-bit, you can Shift+click all of them in your cast window and then go to the Modify menu and choose Transform Bitmap. This brings up the same transform bitmap window from the paint window; however, this time it will apply your bitmap changes to all your selected cast members. This a big timesaver when you are changing hundreds of images from 32-bit to 8-bit.

Shockwave Warning!

Director supports alpha channel masks from Photoshop. However, in order for alpha channels to work correctly, the specific image must stay at 32-bits. Changing the bitmap bit-depth setting of an image with an alpha channel to anything other than 32-bits will delete the alpha channel.

Cult3D Optimization

Optimization of Cult3D files involves altering the target delivery bandwidth and/or altering the number of polygons in your 3D model. However, Cult3D is a streaming technology that will alter the polygon data based on the connection speed. For example, if you have a 250KB 3D model, when users view it on the web, they don't have to wait for the full 250KB to download before the model starts to appear.

Cult3D, just like a progressive JPEG image, improves its quality over time. You can, however, decrease the time required to reach the maximum quality by reducing the number of polygons in your 3D model. In 3ds max, you can add an "optimize" modifier to your 3D model. This reduces the polygon count, making your model smaller. You also can use the poly count tool in 3ds max to teach yourself new ways of creating geometry that doesn't require so many polygons.

Next up for optimization are texture maps. If your textures are too big, your model will take much longer to download. Generally, textures of 512x512 are high resolution for 3D on the web, and 256 or even 128x128 are better.

 



Speed Up Your Site[c] Web Site Optimization
Speed Up Your Site[c] Web Site Optimization
ISBN: 596515081
EAN: N/A
Year: 2005
Pages: 135

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