tags:

views:

23

answers:

1

Hi I am trying to create an output .wmv file using WM Asf writer filter.Here is my code .

IBaseFilter* pASFWriter; CoCreateInstance(CLSID_WMAsfWriter,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**) (&pASFWriter));
pGraphBuilder->AddFilter(pASFWriter,L"FileWriter");
IFileSinkFilter *pSink2=NULL;
pASFWriter->QueryInterface(IID_IFileSinkFilter,(void**)&pSink2); pSink2->SetFileName(OUTFILENAME,NULL);

All of the above return S_OK however there is no file created .I am not able to understand why this is so?

A: 

All you're doing here is creating a DirectShow filter and setting it up to write to a file. Nothing will happen until the filter is connected to other filters that supply it with data and the graph is run. The file won't be created until the first valid data is received.

See this MDSN topic for more information.

Stu Mackellar
Well i try that .I actually want to crop a .wmv file into smaller duration .wmv files .So this is what I do -Source Filter->Sample Grabber Filter->WMA sf writer .The last 2 are connected by 2 pins(video and audio).I then specify the duration desired- by using IMediaPostion for start and stop times.Then I run the graph.Everything else returns S_OK but the run graph command returns a E_FAIL.I dont know why is this happening
Manish