Capture: Performance

VirtualDub

VirtualDub help - Capture: Performance

Capturing live video is a real-time operation and places high demands on your system. Here are some steps you can take to improve video capture performance.

Shut down background tasks and applications

Interruptions by background programs can interfere with video capture and cause dropped frames. Applications you should watch out for, and temporarily disable, include:

  • virus scanners
  • disk defragmenters
  • search indexers, especially the Microsoft Indexing Service (formerly Microsoft Office Fast Find Indexer)
  • task schedulers
  • on-screen tickers and status readers — particularly anything that flashes or scrolls on-screen

CPU usage is a problem here, but competition for the hard disk is usually a much worse problem: any attempts to access the disk by another application will cause the disk to seek back and forth, which seriously cuts available write bandwidth.

Absolutely avoid using the CD-ROM drive during video capture, as the access traffic during the spin-up of the CD-ROM drive can cause the hard drive to go off-line for more than a second.

It is not recommended to use other applications during video capture. Even if the other applications are light in disk and CPU usage, they may cause momentary hiccups that result in dropped frames or timing anomalies during the capture. The less that is going on in the system, the more accurate VirtualDub's timing statistics are and the better it can keep audio and video streams in synchronization.

Note When in capture mode, VirtualDub temporarily sets its process priority to High and disables both the screensaver and power saving mode on the display device. It isn't necessary to change these manually.

Keep the disk clean

Hard drives reach peak write performance when writing sequentially on disk — the more they have to seek around to different regions, the lower the available bandwidth. When files are scattered throughout a disk, free space is broken into a lot of small chunks, which is called fragmentation. This means that it is important to have large areas of contiguous free space on a drive. Here are some tips to improve disk write performance:

  • Run Disk Defragmenter and check that free space is not overly fragmented on the target drive. The fragmentation of existing files doesn't matter, just the free space. It's OK if the free space is split into a few dozen chunks, as a seek every minute isn't a problem. If it's really swiss-cheesed, though, consider defragmenting.
  • Have extra free space on the drive. VirtualDub allocates large blocks of space a time to give Windows a chance to find clear areas on the drive; however, this becomes more difficult as the drive gets full and Windows scavenges for the last free space on the disk. Fragmentation becomes much worse once you start filling the last 5-10% of a drive.
  • Use a different partition or disk than the one that holds Windows system files, as that partition typically has a large number of small, volatile files and fragments very quickly.

Use appropriate video compression and video formats

Uncompressed video capture dumps a lot of data onto the disk — 720x480 in 16-bit YUY2 at 29.97 fps produces approximately 20 megabytes per second. Modern computers have much more CPU power and thus you can reduce the strain on the disk by storing the video in a more efficient format.

Start by choosing an efficient raw video format for your capture device to produce:

  • 32-bit RGB: Avoid this format, as it wastes 33% of the space used.
  • 24-bit RGB: This is the baseline, most compatible format. Start here.
  • 15/16-bit RGB: Avoid, as it introduces serious banding (quantization) artifacts.
  • 16-bit YCbCr (UYVY or YUY2): Try this format. It is closer to the format produced internally by most hardware video decoders and used internally by many video codecs, but it is 33% smaller than 24-bit RGB. Using this format will often significantly improve performance.

Apply video compression on top of this to further reduce data bandwidth. Because the raw video capture will likely need some post-editing to be useful, avoid formats that overly degrade video or are difficult to edit.

  • The Huffyuv video codec by Ben Rudiak-Gould is an excellent capture codec to use, as it is lossless, typically achieves around a 2:1 compression ratio, and can work directly with YCbCr video. It is very fast and should work in real-time on a 500MHz or faster CPU.
  • Motion-JPEG (MJPEG) codecs are also an excellent choice. They are lossy and thus will reduce video quality very slightly, but the compression ratio is significantly better than lossless codecs like Huffyuv, at least 4:1 with little or no perceptible quality loss. The Motion JPEG format is also field-savvy and will store interlaced video without screwing up the fields.
  • Digital Video (DV) is another format to consider. Like Motion JPEG, DV is also a slightly-lossy format that is friendly to interlaced video. It does take a bit more CPU to compress and decompress, however. Also, unlike Motion JPEG, DV is always constant in data rate — 3.6MB/sec — so it is easy to predict how much disk space is required for a given amount of time.
  • MPEG-4 and other high-compression video formats should be avoided, as they require significant CPU power to compress and may not be able to keep up with the incoming video at adequate quality. Also, their extremely long delta frame chains can make the resulting video difficult or impossible to edit.

Note that if you have a capture device that has hardware video compression, your options here are likely very limited. In that case, browse the capture driver's configuration dialogs, usually Video > Video Source or Video > Capture Filter, and select a format with relatively light compression.

Disable audio compression

Uncompressed audio requires much less bandwidth than uncompressed video and reasonable audio compression usually requires a lot of CPU power. This is particularly true of modern audio compression formats such as MPEG audio layer III (MP3). It is highly recommended that you not use audio compression during video capture, as it can consume a lot of CPU and make video capturing less reliable.