Capturing Video to a Windows Media File

本文详细介绍了如何通过连接捕获源到WMASFWriter过滤器来捕获视频并将其编码为Windows Media Video (WMV) 文件,并通过代码示例展示了构建此过程的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

2/14/2007

 

To capture video and encode it to a Windows Media Video (WMV) file, connect the capture pin to the WM ASF Writer filter:

msdn:ms-help://MS.WindowsMobile.6/WindowsMobile6SDK/html/90765fdb-3d77-4770-a690-bf93b51c33f7.htm;

 

You can build the above graph by specifying MEDIASUBTYPE_Asf in the ICaptureGraphBuilder2::SetOutputFileName method, as demonstrated in the following code.

 
IBaseFilter* pASFWriter = 0;
hr = pBuild->SetOutputFileName(
    &MEDIASUBTYPE_Asf,   // Create a Windows Media file.
    L"//My Documents/VidCap.wmv",   // File name.
    &pASFWriter,         // Receives a pointer to the filter.
    NULL);  // Receives an IFileSinkFilter interface pointer (optional).

The value MEDIASUBTYPE_Asf tells the Capture Graph Builder to use the WM ASF Writer filter as the file sink. The Capture Graph Builder creates the filter, adds it to the graph, and calls IFileSinkFilter::SetFileName to set the name of the output file. It returns a pointer to the filter as an outgoing parameter (pASFWriter in the previous code example).

Call ICaptureGraphBuilder2::RenderStream to connect the capture filter to the ASF Writer:

 
hr = pBuild->RenderStream(
    &PIN_CATEGORY_CAPTURE,   // Capture pin.
    &MEDIATYPE_Video,        // Video. Use MEDIATYPE_Audio for audio.
    pCap,                    // Pointer to the capture filter. 
    0, 
    pASFWriter);             // Pointer to the sink filter (ASF Writer).

Each input pin on the WM ASF Writer filter corresponds to a stream in the Windows Media profile. You must connect every pin, so that the file content matches the profile

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值