/// <summary> /// Renders to AVI. /// </summary> /// <param name="outputFile">The output file.</param> /// <param name="videoCompressor">The video compressor.</param> /// <param name="audioCompressor">The audio compressor.</param> /// <param name="videoParticipants">The video participants.</param> /// <param name="audioParticipants">The audio participants.</param> private void RenderToAVI( string outputFile, IBaseFilter videoCompressor, IBaseFilter audioCompressor, ICallbackParticipant[] videoParticipants, ICallbackParticipant[] audioParticipants) { if (string.IsNullOrEmpty(outputFile)) { throw new ArgumentNullException("outputFile"); } if (FirstVideoGroup == null) { throw new SplicerException(Resources.ErrorCanNotRenderAviWhenNoVideoGroupExists); } int hr; if (outputFile == null) { throw new SplicerException(Resources.ErrorInvalidOutputFileName); } // Contains useful routines for creating the graph var graphBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2(); try { hr = graphBuilder.SetFiltergraph(Graph); DESError.ThrowExceptionForHR(hr); // Create the file writer IBaseFilter multiplexer = StandardFilters.RenderAviDestination(Cleanup, graphBuilder, outputFile); try { RenderGroups(graphBuilder, audioCompressor, videoCompressor, multiplexer, audioParticipants, videoParticipants); } finally { Marshal.ReleaseComObject(multiplexer); } DisableClock(); } finally { Marshal.ReleaseComObject(graphBuilder); } }