Skip to main content
IMFSampleOutputStream interface

Writes media samples to a byte stream.


The IMFSampleOutputStream interface inherits from the IUnknown interface. IMFSampleOutputStream also has these types of members:


The IMFSampleOutputStream interface has these methods.


Begins an asynchronous request to write a media sample to the stream.


Completes an asynchronous request to write a media sample to the stream.



A writeable byte stream can optionally implement this interface.

This interface enables the caller to send media samples to the byte stream for writing, instead of using the IMFByteStream::BeginWrite method to write blobs of untyped data. The byte stream can use the information contained in the media sample to optimize how it writes the data. For example, a byte stream that sends media data over a network can optimize based on the time stamp.

To get a pointer to this interface, call QueryInterface on the byte stream object.

Any implementation of IMFByteStream that exposes IMFSampleOutputStream as an interface needs to honor the following requirements:

  • All writes from either interface always go to the exact same byte stream object.
  • The current position for both IMFSampleOutputStream and IMFByteStream shall always be the same. For example, writing to IMFSampleOutputStream will also update the current position of IMFByteStream.
  • Writing a sample using BeginWriteSample and EndWriteSample shall serialize the sample by writing the data from all the buffers in the sample, in the order in which the buffers are stored in the sample. (Use IMFSample::GetBufferByIndex to get the individual buffers by index value.) The total bytes copied shall be the number of bytes written from all the buffers.


Minimum supported client

Windows 8 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2012 [desktop apps | UWP apps]


Mfobjects.h (include Mfidl.h)

See also

Media Foundation Interfaces