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.