MFCreateMPEG4MediaSink function (mfidl.h)

Creates a media sink for authoring MP4 files.

Syntax

HRESULT MFCreateMPEG4MediaSink(
  [in]  IMFByteStream *pIByteStream,
  [in]  IMFMediaType  *pVideoMediaType,
  [in]  IMFMediaType  *pAudioMediaType,
  [out] IMFMediaSink  **ppIMediaSink
);

Parameters

[in] pIByteStream

A pointer to the IMFByteStream interface of a byte stream. The media sink writes the MP4 file to this byte stream. The byte stream must be writable and support seeking.

[in] pVideoMediaType

A pointer to the IMFMediaType interface of a video media type. This type specifies the format of the video stream.

This parameter can be NULL, but not if pAudioMediaType is NULL.

[in] pAudioMediaType

A pointer to the IMFMediaType interface of an audio media type. This type specifies the format of the audio stream.

This parameter can be NULL, but not if pVideoMediaType is NULL.

[out] ppIMediaSink

Receives a pointer to the MP4 media sink's IMFMediaSink interface. The caller must release the interface.

Return value

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

Remarks

The MP4 media sink supports a maximum of one video stream and one audio stream. The initial stream formats are given in the pVideoMediaType and pAudioMediaType parameters. To create an MP4 file with one stream, set the other stream type to NULL. For example, to create an audio-only file, set pVideoMediaType to NULL.

The number of streams is fixed when you create the media sink. The sink does not support the IMFMediaSink::AddStreamSink method.

To author 3GP files, use the MFCreate3GPMediaSink function.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header mfidl.h
Library Mf.lib
DLL Mf.dll

See also

MPEG-4 File Sink

Media Foundation Functions