DirectShow capabilities can be separated into three broad areas, which reflect the three basic types of DirectShow filters. First are the capture capabilities. DirectShow can orchestrate capture of audio from the microphone or from a line input, can control a digital camcorder or D-VHS VCR (a nifty new kind of VCR that stores video digitally in high resolution), or can capture both audio and video from a live camera, such as a webcam. DirectShow can also open a file and treat it as if it were a live source; this way, you can work on video or audio that you ve previously captured.
Once the media stream has been captured, DirectShow filters can be used to transform it. Transform filters have been written to convert color video to black-and-white, resize video images, add an echo effect to an audio stream, and so on. These transform filters can be connected, one after another, like so many building blocks, until the desired effect is achieved. Streams of audio and video data can be split and sent to multiple filters simultaneously, as if you added a splitter to the coaxial cable that carries a cable TV or satellite signal. Media streams can also be multiplexed, or muxed, together, taking two or more streams and making them one. Using a mux, you can add a soundtrack to a video sequence, putting both streams together synchronously.
After all the heavy lifting of the transform filters has been accomplished, there s one task left: rendering the media stream to the display, speakers, or a device. DirectShow has a number of built-in render filters, including simple ones that provide a window on the display for video playback. You can also take a stream and write it to disk or to a device such as a digital camcorder.
Most DirectShow applications don t need the full range of DirectShow s capabilities; in fact, very few do. For example, Windows Media Player doesn t need much in the way of capture capabilities, but it needs to be able to play (or render) a very wide range of media types MP3s, MPEG movies, AVI movies, WAV sounds, Windows Media, and so on. You can throw almost any media file at Windows Media Player (with the notable exception of Apple QuickTime and the RealNetworks media formats), and it ll play the file without asking for help. That s because Windows Media Player, built with DirectShow, inherits all of DirectShow s capabilities to play a broad range of media.
On the other hand, Windows Movie Maker is a great example of an application that uses nearly the full suite of DirectShow capabilities. It s fully capable of communicating with and capturing video from a digital camcorder (or a webcam). Once video clips have been captured, they can be edited, prettied up, placed onto a timeline, mixed with a soundtrack, and then written to disk (or a digital camcorder) as a new, professional-looking movie. You can even take a high-resolution, high-bandwidth movie and write it as a low-resolution, low-bandwidth Windows Media file, suitable for dropping into an e-mail message or posting on a Web site. All of these capabilities come from Windows Movie Maker s extensive use of DirectShow because they re all DirectShow capabilities.
The flexibility of DirectShow means that it can be used to rapidly prototype applications. DirectShow filters can be written quickly to provide solutions to a particular problem. It s widely used at universities and in research centers including Microsoft s own to solve problems in machine vision (using the computer to recognize portions of a video image) or for other kinds of audio or video processing, including the real-time processing of signals. It s easy to write a DirectShow filter (at least, it ll seem easy once you ve read this book); many people with a background in C++ have written their own filters.
There are some tasks that DirectShow can t handle well, a few cases in which rolling your own is better than using DirectShow. These kinds of applications generally lie on the high end of video processing, with high-definition video pouring in at tens of millions of bits per second or multiple cameras being choreographed and mixed in real time. Right now these kinds of applications push even the fastest computers to the limits of processor speed, memory, and network bandwidth. That s not to say that you ll never be able to handle high-definition capture in DirectShow or real-time multicamera editing. You can write DirectShow applications that edit high-definition images and handle real-time multicamera editing. However, can you get a computer fast enough to run these DirectShow programs? You might, if you wanted to spend $15,000 on a dual-processor Pentium 4 system running at 3 GHz. (And if you re interested that kind of high-performance work, you might have that kind of budget to throw around.)
In any case, DirectShow isn t magic; working with video is both processor-intensive and memory-intensive, and many DirectShow applications will use every computing resource available, up to 100 percent of your CPU. So when you make the decision to use DirectShow for a project, set your expectations appropriately. DirectShow is an excellent architecture for media processing, but it isn t perfect. It s up to you to determine whether you re asking too much of DirectShow.