IMFSinkWriter::Finalize method

Completes all writing operations on the sink writer.


HRESULT Finalize(



This method has no parameters.

Return Value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


Call this method after you send all of the input samples to the sink writer. The method performs any operations needed to create the final output from the media sink.

If you provide a callback interface when you create the sink writer, this method completes asynchronously. When the operation completes, the IMFSinkWriterCallback::OnFinalize method of your callback is called. For more information, see MF_SINK_WRITER_ASYNC_CALLBACK. Otherwise, if you do not provide a callback, the Finalize method blocks until the operation completes.

Internally, this method calls IMFStreamSink::PlaceMarker to place end-of-segment markers for each stream on the media sink. It also calls IMFFinalizableMediaSink::BeginFinalize and EndFinalize if the media sink supports the IMFFinalizableMediaSink interface.

After this method is called, the following methods will fail:

If you do not call Finalize, the output from the media sink might be incomplete or invalid. For example, required file headers might be missing from the output file.

This interface is available on Windows Vista if Platform Update Supplement for Windows Vista is installed.


Minimum supported client Windows 7, Windows Vista and Platform Update Supplement for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header mfreadwrite.h

See Also


Sink Writer