DirectShow RedenStream无法捕获 [英] directshow RedenStream Fails for Capture
问题描述
我正在制作一个Directshow应用程序来捕获MP4视频.我使用下面的图形来做到这一点.
I am making an Directshow Application to Capture MP4 video. I use below graph to do so.
Input Stream --> MJPEG Decompressor --> x264vfw H.264/MPEG-4 AVC Codec --> GDCL Mpeg-4 Multiplexor --> File Writer
在我的DirectShow应用程序中,我创建了所需的过滤器,并将它们连接到图形上,最后我执行了文件写入器操作,并使用pin作为捕获来使流变红.我的代码的一部分如下.
in my directshow application , i created the required filters and connect them on graph , at end i do file writer operation and redder stream using pin as capture. that part of my code is as below.
GUID guid;
guid = MEDIASUBTYPE_x264;
hr = gcap.pBuilder->SetOutputFileName(&guid, gcap.wszCaptureFile,
&g_mp4mux, &gcap.pSink);
hr = gcap.pBuilder->RenderStream(&PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Interleaved,
gcap.pVCap, pVcompFilter, NULL);
if(hr != NOERROR)
{
hr = gcap.pBuilder->RenderStream(&PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Video,
gcap.pVCap, pVcompFilter, NULL);
if(hr != NOERROR)
{
ErrMsg(TEXT("Cannot render video capture stream"));
TearDownGraph();
return FALSE;
}
}
上面的代码
g_mp4mux
是GDCL MPEG-4 Muliplexrer
文件管理器
PVcompFilter
是x264vfw H.264/MPEG-4 AVC codec
过滤器
当我运行以上代码时,我得到HR = E_INVALIDARG
.
when i run above code i get HR = E_INVALIDARG
.
不知道上面的代码有什么问题. 请帮助.谢谢.
no idea what is wrong in above code. Plz help. Thanks.
推荐答案
RenderStream
在内部执行多个步骤,并且如果在序列期间发生任何错误,则该错误将不带任何细节地转发回去.因此,E_INVALIADRG
就是您所拥有的,您不知道这是您的调用还是某些内部错误的论点.
RenderStream
does a number of steps internally and should any error happen during the sequence, the error is forwarded back without details. Hence, E_INVALIADRG
is all you have, you don't know if this is a wrong argument on your call or some internal.
对于初学者,请检查您的参数(您可能在第3个和第4个参数中传递了NULL
),然后如果没有帮助,请使用直接图形构建调用(例如IGraphBuilder :: Connect)替换RenderStream,以了解更多有关错误.
For starters, check your arguments (you might be passing NULL
s in 3rd and 4th parameters), then if it is not helpful replace RenderStream with direct graph building calls such as IGraphBuilder::Connect to possibly learn more about the error.
Also mention your cross-posting: at msdn.microsoft.com
这篇关于DirectShow RedenStream无法捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!