Capturing Video from a Digital Camcorder to Disk

Capturing Video from a Digital Camcorder to Disk

One of the most important capabilities of DirectShow is its ability to make quick work of the various audio and video capture devices, such as DV camcorders, which have become increasingly popular in the last few years. Many PCs have IEEE 1394 (FireWire) connectors so that DV camcorders can be plugged directly into a PC for digital capture, editing, and production of video material. In particular, Microsoft Windows XP makes it very easy to work with digital camcorders, and the inclusion of Windows Movie Maker provides a level of software support for the digital camcorder that hasn t been seen before in Windows systems. For the rest of this chapter, we ll assume that there s a DV camcorder attached to your computer system, most probably through a high-speed IEEE 1394 interface.

You ll now use GraphEdit to create a filter graph that will take the input from the capture source filter representing the DV camcorder and write that data out to disk as a high-resolution AVI movie file. To begin, clear the filter graph with the New item from the File menu. Now open the Insert Filters dialog box, and open the list of Video Capture Sources. Depending on how many video capture devices are attached to your system, this list could be quite long or could contain just one entry.

If you don t see anything on the list, make sure your camera is on and plugged in to your computer correctly. If you still don t see anything on the list, you might be having a problem with the drivers associated with your DV camcorder. Windows XP includes a standard driver for camcorders connected with IEEE 1394, but your camcorder won t necessarily work correctly with that driver.

Somewhere in the list you ll see the entry Microsoft DV Camera And VCR. This is the standard DirectShow filter that acts as a capture source filter for both digital camcorders and VCRs. Add the filter to the filter graph. Next add the DV Splitter from the list of DirectShow filters and connect the DV A/V Out pin from the source filter to the Input pin of the DV Splitter filter. The DV Splitter, as the name suggests, splits the audio/video (A/V) stream coming from the source filter into two streams, an audio stream identified on an output pin as AudOut00 and a video stream identified as DVVidOut0.

You would like to be able to monitor the video stream so that you can see what s coming out of the camera as the video stream is being written to disk. For you to do so, the video stream must be split into two components, which can be done using a DirectShow transform filter known as the Smart Tee. When this transform filter is inserted into the filter graph, the DV Splitter output pin DVVidOut0 should be connected to its input pin. The Smart Tee has two output pins, appropriately labeled Capture and Preview. If you use the Render Pin function on the Preview pin of the Smart Tee, you get a filter graph that can monitor the output of the camcorder. The filter graph should now look like Figure 2-15.

figure 2-15 an incomplete filter graph for dv camcorder capture and monitoring

Figure 2-15. An incomplete filter graph for DV camcorder capture and monitoring

At this point, the separate audio and video streams have to be recombined (or multiplexed) into a single stream so that they can be written to a file. Add the AVI Mux DirectShow transform filter to the graph. The AVI Mux has one input pin, Input 01. Connect the output pin Capture from the Smart Tee to this input pin, and a second input pin, Input 02, appears on the AVI Mux. (This proc ess will keep going indefinitely; as you add inputs, the AVI Mux adds pins.) Connect the AudOut00 pin from the DV splitter to the Input 02 pin on the AVI Mux. Now the AVI Mux is mixing the video and audio streams from the camcorder into a single AVI-formatted stream. Finally add a File Writer renderer filter from the Insert Filters dialog box. Doing so will open a file-selection dialog box that asks for an output file name. Call this file DVCAM.AVI. Once the filter has been added to the filter graph, connect the AVI Out pin of the AVI Mux to the In pin of the DVCAM.AVI File Writer. The completed filter graph should look like Figure 2-16.

figure 2-16 the complete filter graph for dv camcorder capture and monitoring

Figure 2-16. The complete filter graph for DV camcorder capture and monitoring

When you click Play, a monitor window will open on the display, showing the live output from the camcorder, as shown in Figure 2-17.

figure 2-17 the dv capture filter graph displaying the live output from the camcorder

Figure 2-17. The DV capture filter graph displaying the live output from the camcorder

AVI files get big very quickly, at the rate of about 250 MB per minute, so make sure you have plenty of disk space available when you run this filter graph. After you click the Stop button, an AVI file named DVCAM.AVI is on the disk. This file can be played in the Windows Media Player, or you can use the Render Media File menu item in GraphEdit to play it. You ll see that the filter graph faithfully captured the camera s output to disk.

Filter graphs created by GraphEdit can be saved to disk or opened from disk. If you choose Save Graph from the application s File menu, you can save the filter graph to a file with a .GRF extension. GraphEdit will open .GRF files and other GraphEdit files, so if you re tinkering with a filter graph design, you can save work in progress and return to it later.



Programming Microsoft DirectShow for Digital Video and Television
Programming Microsoft DirectShow for Digital Video and Television (Pro-Developer)
ISBN: 0735618216
EAN: 2147483647
Year: 2002
Pages: 108
Authors: Mark D. Pesce

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