Question

Following is my Filter Graph. I am trying to insert "ffdshow video encoder" encoder in the filtergraph, but I am unable to do so.enter image description here

Following is my Code for trying to Connect Compressor after getting filtergraph generated:

public void setFileName(string pFileName)
    {
        int hr;
        IBaseFilter _infinitePinTeeFilter = null;
        graph.FindFilterByName("Infinite Pin Tee Filter", out _infinitePinTeeFilter); 

        mediaControl.Stop();
        hr = captureGraphBuilder.SetOutputFileName(MediaSubType.Avi, pFileName, out mux, out sink);
        checkHR(hr, "Can't set SetOutputFile");
        hr = captureGraphBuilder.RenderStream(null, MediaType.Video, _infinitePinTeeFilter, _videoCompressor, mux);
        checkHR(hr, "Can't Render Output File");
        mediaControl.Run();
    }

Any help would be appreciated... Thanks.

Was it helpful?

Solution

ICaptureGraphBuilder::SetOutputFileName is not a good choice of API to set the graph up. It does the job well for simple graphs, but as it forwards you back errors without good description and the stage at which the error actually happened, every time you have hard time trying to understand what goes wrong.

The problem might be caused by absence of frame rate information on the media type on the output of video compressor, but as the building stage you have on your screenshot you don't even have this media type yet available and you cannot troubleshoot and get this information.

Use IGraphBuilder::AddFilter, IGraphBuilder::Connect, IFileSinkiFilter::SetFileName instead to reliably configure the pipeline.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top