GDCL Home About GDCL DirectShow WinNt & WDM
GDCL Home / Technology / Drivers /Video Capture

Direct Show and Video Capture

DirectShow provides source filters that talk to VfW capture drivers (either 16-bit or 32-bit) and a WDM proxy filter that talks to WDM Streaming capture drivers. For a discussion of the choices for driver models, see here.

The video capture source filter's output will then be routed to 2 streams: a preview and a capture stream. Since the capture stream may well be compressed in hardware, the preview stream provides a means for the hardware driver to supply a preview image from before the compressor to save decompression for previewing. For drivers where this does not apply, DirectShow provides an intelligent tee filter to split off a preview stream, which would normally be connected to a video renderer.

The capture stream can then be written to disk: for increased flexibility, the multiplexor determining the file format is separate from the file writer. Or the data can be fed through an encoder, or even passed to the application for processing.

On older operating systems (Windows 95 to Windows NT), the situation is more complicated and is described here.

Capture Graph Building

DirectShow provides a capture graph builder to assist in building graphs for recording and capture. This is a COM object separate to the filter graph and supports the ICaptureGraphBuilder interface, which provides methods for building both the source segments and the destination segments of the graph.

The capture graph builder is vital when working with WDM Video Capture. Many WDM video capture drivers provide several different components that need to be connected for the driver to work. This may include a tuner and decoder as well as the capture device, and a crossbar (allowing selection between multiple inputs). These will appear as separate filters in the graph, even though all the data flow is in hardware and not between the pins. For WDM Video Capture, the connections between these filters are determined by medium GUIDs - unique identifiers that represent a particular hardware path.

When building a graph for one of these devices, the user or application will have selected the capture filter itself using an enumeration from IFilterMapper2. This will have selected the right-mode of the capture device's filters, with output pins that provide captured data via normal DirectShow transports. The filters upstream of this are then connected up working in an upstream direction, using the medium GUIDs exposed by the pins (through IKsControl). This upstream building process, which is not documented by Microsoft, happens invisibly during a call to ICaptureGraphBuilder::FindInterface. See the capture sample in the DirectShow SDK - this is the AMCap.exe application, and shows how to build and use DirectShow capture graphs.

Note that there is a similar special-case helper for building DVD Graphs.

Video Capture Topics

DirectShow and Video Capture
Video Capture on Older Platforms
Video Capture on NT 4.0

Related Topics

WDM Streaming