I actually want to crop a .wmv file into multiple shorter duration .wmv files .Here is my code

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

IBaseFilter *pSourceB;
pGraphBuilder->AddSourceFilter(FILENAME,L"Source",&pSourceB);
IBaseFilter *pGrabberF2=NULL;
ISampleGrabber *pGrabber2=NULL;
CoCreateInstance(CLSID_SampleGrabber,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&pGrabberF2));
pGraphBuilder->AddFilter(pGrabberF2,L"Sample Grabber2");
pGrabberF2->QueryInterface(IID_ISampleGrabber,(void**)(&pGrabber2));




pSourceB->EnumPins(&pEnum2);
pEnum2->Next(1,&pPin2,NULL);
ConnectFilters(pGraphBuilder,pPin2,pGrabberF2);//Source to Grabber

pGrabberF2->EnumPins(&pEnum3);
pASFWriter->EnumPins(&pEnum4);

while (S_OK==pEnum3->Next(1,&pPin3,NULL)&& S_OK==pEnum4->Next(1,&pPin4,NULL)){

pGraphBuilder->Connect(pPin3,pPin4);//Grabber to FileWriter


}

pGraphBuilder->RenderFile(FILENAME,NULL);

pMediaPosition->put_CurrentPosition(start);
pMediaPosition->put_StopTime(stop);
HRESULT test1=pMediaControl->Run();
pMediaEvent->WaitForCompletion(-1,&eventcode);
pMediaControl->Stop();

In this everything returns S_OK except test1 which returns E_FAIL.When I run the program a blank screen shows up and no output file is created.Any idea whats wrong?