Index Topic Contents | |||
Previous Topic: About Capture Filter Graphs Next Topic: Data Flow in the Filter Graph |
Improving Capture Performance
Capturing is a hardware-intensive operation that requires saving a large amount of information to disk as quickly as possible. This information is typically in the form of video and audio data. Reducing bottlenecks that slow down the system is very important, because it can help improve the quality of the captured movie.
This article presents some general suggested practices and hints and tips that can help you, as the user of a capture application, set up the capture system for optimal capture performance.
Note Be sure to read your capture card manual for information specific to your capture card. Systems vary as well, so all the information presented in this article might not apply to your system configuration.
See Capture Introduction for a brief introduction to capture. See capture topics for a list of Microsoft® DirectShow interfaces and articles relating to capture.
Contents of this article:
- Capture Numbers
- Optimizing the Hard Disk for Capture
- Disk Settings in Window 95 and Later
- Reducing Noncapture-Related Machine Activity
- Additional Hints and Tips for Improving Capture Performance
- Choosing a Capture System
- Suggested Capture Reading
Capture Numbers
Capturing involves transferring a large amount of data from a capture card to disk. To get an idea of the amount of data and the data throughput required for a particular capture scenario, consider the following:
Suppose you want to capture a movie with a height of 320 pixels, a width of 240 pixels, a capture rate of 30 frames per second (fps), and in 24-bit color format. The movie does not include any sound.
Use the following formula to determine the number of bytes of uncompressed data that must be transferred every second in order to capture all of the image data, and therefore to maintain the image quality.
bytes of transferred video data = height (in pixels) x width (in pixels) x rate (in fps) x color depth (in bytes)
Plugging in the numbers from the preceding scenario produces the following result.
320 x 240 x 30 x 3 = 6912000 bytes of transferred video data
Capturing one second of this movie at the desired size, frame rate, and color depth requires approximately 6.9 million bytes of disk space. Multiplying by 60 seconds produces the results for a minute; each minute of capture requires 414,720,000 bytes in this case. You can reduce the amount of data required by reducing any of the parameters in the above formula: capture a smaller image, at fewer frames per second, or with fewer colors. However, in cases where your image requirements push the system to its limits and you need to be able to capture at the highest possible number of megabytes per second, you'll want to optimize your system as much as possible. After all, the capture settings you use affect how the movie will look when someone plays it back.
The preceding numbers are for a silent movie. If you want to capture audio as well as video, you have to add the amount of required audio data. For example, CD-quality audio, recorded at 44 kilohertz (kHz), 16-bit, stereo, requires about 172 kilobytes (KB) per second. Audio capture is also very CPU-intensive, and synchronizing the audio and video data (to achieve proper lip synch, for example) can cause delays as well.
You might find that your system can't keep up with the required amount of data transfer for the settings you've chosen. When capturing, your system might pause, the video might be jerky or jitter (not smooth), and some of the frames might be dropped (not saved to disk). Playback quality of such an image is typically unsatisfactory. To avoid such problems, you can follow a number of practices to optimize your system for capturing.
The suggestions presented in this article can help you reach the goal of optimal capture performance. At the same time, bear in mind that each system is different and something that improves performance on one system might not be effective on another system.
Optimizing the Hard Disk for Capture
Because capturing is very hard-disk intensive, optimizing the files on the hard drive that you'll use for capturing (also called the data drive or data disk) is the most important task in optimizing capture performance. The following list contains goals in optimizing the data drive and techniques you might use to achieve those goals. The techniques discussed here are suggestions and might not be helpful given particular capture requirements. Your requirements and resources govern precisely which techniques you might want to try.
- Ensure the capture file is in a contiguous (nonfragmented) location on the data drive.
The heads of a hard drive can read from and write to a contiguous file more efficiently than if they have to seek to other, nonadjacent portions of the disk. Use a tool such as the Microsoft Windows® Disk Defragmenter (Defrag.exe) to defragment your data disk. Defragment both the data drive and the operating system drive. The operating system drive comes into play when using drivers (such as audio and video drivers), writing to the system cache, writing to the registry, using overlays, and so forth. Run the Windows 95 Scandisk tool to ensure the integrity of the data drive and the operating system drive.
- Preallocate a capture file that is larger than any movie clips you expect to save.
Allocating file space is time-consuming, so you should allocate your file before you capture. Capture software such as the DirectShow AMCap sample lets you allocate space for the capture file. If you capture more data than will fit in the capture file, the system has to allocate more space for the file as you capture, which, again, slows down capture. Avoid the reallocation of file space during capture, and the speed penalty, by allocating a file that is large enough to meet your needs. Saving the captured data can require as much space as the original capture file, so ensure you have enough free hard disk space to save your captured data to another file. Be sure to regularly defragment your capture file as well.
- Devote an entire hard disk, or partition on the disk, for the capture file.
This technique is particularly useful under Windows NT® because Windows NT does not include a Scandisk or Disk Defragmenter tool. Reserving an entire disk or partition on the disk for the capture file can make it easier to keep the capture file space clean and contiguous. You can format such a disk or partition, and then preallocate file space again, or defragment it without having to worry about other files on the disk or partition. When you format a dedicated capture drive, use the full format to initialize the disk rather than a quick format that leaves old data on the disk.
Save your captured images to a directory that is not on your data drive or data partition to help keep your data drive clean. If you can't devote an entire drive to capture, allocate space for the capture file, defragment the file, and (in Windows 95) run the Windows 95 Scandisk tool.
- Place the capture file at the beginning (outer rim) of the data drive.
If you allocate the capture file as the only file on the disk, or as the only file in the first partition on the disk, it will begin at the outer rim of the disk. Access to the outer portion of a hard disk is faster than access to the inner portion of the disk. If you don't have a hard drive to devote to capture, you can use disk utilities to move your capture file to the beginning of the disk.
Revisit these goals as necessary before each capture session to ensure your disk is configured for optimal performance. Defragment the data disk before each capture session and defragment the drive containing your saved images before you play back the saved files.
Disk Settings in Window 95 and Later
The System applet of the Windows 95 and OSR2 Control Panel contains several options you can disable for optimal capture performance. In high-bandwidth situations like capture, it's important to make sure the drive is writing as much data as possible and not spending time with software optimizations or checking for system changes. The options to disable include the following:
- Automatic detection that a CD-ROM disc has been inserted in the CD-ROM drive
- Read-ahead optimization for the hard disk
- Write-behind caching for all drives
To access these options in Windows 95, click the Start menu. Under Settings, click Control Panel, and double-click the System applet. Select the appropriate tab and proceed as outlined below:
- Device Manager tab: Click CD-ROM and click your CD-ROM drive. Click the Properties button, select the Settings tab and clear the Auto insert notification check box.
- Performance tab: Click the File System button and drag the Read-ahead optimization slider to None. (The default is Full.) While still on the File System Properties dialog, select the Troubleshooting tab and check Disable write-behind caching for all drives.
You will have to restart your machine for the new settings to take effect.
Note For optimal performance for other applications, be sure to return these settings to their original values after your capture session is complete.
Reducing Noncapture-Related Machine Activity
Anything that interrupts the system or consumes CPU time for purposes other than capture can potentially decrease capture performance. Consider performing the following tasks to see if they affect performance on your system.
- Close all applications except the capture application.
- Turn off the clock that Windows 95 displays on the taskbar. To do so, right-click the taskbar, click Properties and clear the Show Clock check box on the Taskbar Options tab.
- Turn off the screen saver. To do so, right-click the desktop, click Properties, select the Screen Saver tab, and choose "(None)" from the screen saver drop-down combo box.
- Turn off your printer.
- Disable your network card if you have one. Sending and receiving data over the network can interrupt the system, even if you aren't actively doing anything over the network.
Additional Hints and Tips for Improving Capture Performance
This section contains a collection of hints and tips for improving capture performance that you might want to try after experimenting with the other suggestions in this article. The suggestions are grouped according to hardware and software-related suggestions.
Software
- Consider capturing on Windows NT, because the Windows NT file system (NTFS) is typically faster than the traditional FAT file system, due to its use of threads. You might need to contact the manufacturer of your capture card for a driver that will work on Windows NT. Use a dedicated NTFS drive rather than a drive that is part NTFS and part FAT. The FAT-32 file system is typically faster than the FAT file system.
- Using your capture software, experiment with different compression ratios (for example 2:1 or 1:1) to decrease the amount of data that has to be saved. Start with the default compression ratio and increase it until you drop frames. Try three passes and take the best results of the three. After you've saved the captured image to another drive, run Scandisk on the standard setting to quickly defragment the drive.
- If you installed Windows 95 over your Windows 3.1 installation, put the line "verify=off" in your Autoexec.bat file. This line will prevent DOS from re-reading data after a write operation to make sure the correct data was written. Verification slows down the writing operation.
Hardware
- Insert the capture card in PCI slot zero so it will be checked for activity before other cards on the system.
- Make sure the hard drive cache is turned on for the data drive. Refer to your SCSI card manual for more information.
- Heat buildup inside a system can wear down the system components and decrease capture performance. If you will be capturing continuously for hours at a time, make sure your system has three fans: one each for the power supply, CPU, and components (cards). If your captured images look fine at first, but become jittery after the system has been capturing for a while, the capture card might be overheating.
- Some capture cards include a built-in audio card. Whether you use the on-board audio card or a separate audio card depends on your needs. You might find that a separate audio card provides features you need, or the on-board audio card might suit you just as well.
- Some capture cards have an external connection for a monitor so you don't have to go through software to preview what you're capturing. That feature can help with performance, because the system isn't busy with the preview window.
Choosing a Capture System
Capturing is possible with a wide range of systems and capture cards. Shop around to compare capture cards and features to see what best meets your needs. See Suggested Capture Reading for possible sources of information. The optimal hardware configuration varies depending on the capture card.
If you're setting up a new machine to devote to capture, consider a 166-megahertz Pentium or later, with 64 megabytes or more of EDO RAM (as much RAM as possible), and a 2-gigabyte or larger Wide SCSI 2.0 AV-certified hard disk. AV-certified drives are designed for high-bandwidth data transfer. The SCSI hard disk controller should support PCI bus mastering 2.0 and later, which uses 32-bit drivers. If your capture card supports overlays, ensure that your video card also supports overlays. Make sure the capture card has drivers for the operating system you plan to use.
Suggested Capture Reading
This section lists possible sources of information about capture.
- http://www.ccs.queensu.ca/pubs/itsnote/VideoCapture.html contains a general introduction to video capturing.
- http://gcunix.gc.maricopa.edu/~IC/vidph/vidph05.html contains information about organizing the capture process.
- http://fre.www.ecn.purdue.edu/FrE/asee/fie95/3a2/3a25/3a25.htm contains an article titled "Effective Video Capture Techniques for Educational Multimedia."
- http://www.worldguide.com/Tech/videocapture.html contains information about setting up a system for video capture and compression.
- http://cctpwww.cityu.edu.hk/public/graphics/g3_vidcap.htm contains information about some capture card and chip manufacturers.
- Search the World Wide Web for "capturing".
- Contact the manufacturers of various capture cards, many of whom are available on the Web.
- See the manual for each capture card for its particular requirements.
- For general background regarding digital video, see "PC Video Madness!", by Ron Wodaski, Sams Publishing, Carmel, Indiana, c. 1993, ISBN 0-672-30322-1.
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.