Capture a Type-1 DV File
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
A type-1 DV AVI file contains a single interleaved stream. To capture a type-1 file while previewing, use the filter graph shown in the following diagram.
Filters in this graph include:
- The Smart Tee filter splits the interleaved DV into a capture stream and a preview stream. Both streams contain the same interleaved data.
- The AVI Mux and File Writer write the interleaved stream to disk.
- The DV Splitter splits the interleaved stream into a DV video stream and an audio stream. Both streams are rendered for preview.
- The DV Video Decoder decodes the DV video stream for previewing.
Build this graph as follows:
ICaptureGraphBuilder2 *pBuilder; // Capture graph builder.
IBaseFilter *pDV; // DV capture filter (MSDV)
IBaseFilter *pAviMux // Avi Mux filter.
// Initialize pDV (not shown).
// Create and initialize the Capture Graph Builder (not shown).
// Create the file-writing section of the graph.
hr = pBuilder->SetOutputFileName(&MEDIASUBTYPE_Avi,
OLESTR("C:\\Example1.avi"), &pAviMux, 0);
// Render the capture stream.
hr = pBuilder->RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved,
pDV, 0, pAviMux);
// Render the preview stream.
hr = pBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Interleaved,
pDV, 0, 0);
// Remember to release all interfaces.
- Call ICaptureGraphBuilder2::SetOutputFileName to connect the AVI Mux filter to the File Writer filter.
- Call ICaptureGraphBuilder2::RenderStream with the pin category PIN_CATEGORY_CAPTURE to render the capture stream. The Capture Graph Builder automatically inserts the Smart Tee filter.
- Call RenderStream again, but with the pin category PIN_CATEGORY_PREVIEW, to render the preview stream. Skip this call if you do not want to preview the video.
For both calls to RenderStream, the media type is MEDIATYPE_Interleaved, meaning interleaved DV video. In this code, the Capture Graph Builder automatically adds every filter that is needed, except for the MSDV capture filter.
Related topics