问题
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
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;
}
}
On above code
g_mp4mux is GDCL MPEG-4 Muliplexrer filer
PVcompFilter is x264vfw H.264/MPEG-4 AVC codec Filter
when i run above code i get HR = E_INVALIDARG .
no idea what is wrong in above code. Plz help. Thanks.
回答1:
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.
For starters, check your arguments (you might be passing NULLs 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
来源:https://stackoverflow.com/questions/10600563/directshow-redenstream-fails-for-capture