The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MediaCapture.SetEncoderProperty | setEncoderProperty method

Applies to Windows and Windows Phone

Sets an encoding property.


mediaCapture.setEncoderProperty(mediaStreamType, propertyId, propertyValue);



Type: MediaStreamType

The type of media data the stream represents, such as video or audio.


Type: String [JavaScript] | System.Guid [.NET] | Platform::Guid [C++]

The encoding property to set.


Type: Object [JavaScript] | System.Object [.NET] | Platform::Object [C++]

The new value of the encoding property.


You can only call SetEncoderProperty with mediaStreamType equal to MediaStreamType.Audio, if the encoder property is applied to only the audio encoder in the record sink. The preview sink does not allow you to set an encoding profile with compressed audio.

For non-H.264 cameras, when you call SetEncoderProperty before recording or previewing has started, the property is stored locally. When you start recording, the property is applied to the encoder at the time of encoder initialization. To configure static encoding properties, you must call SetEncoderProperty before recording or previewing starts. Before recording or previewing starts, GetEncoderProperty will return the value of the property stored locally.

If the camera is a H.264 camera and the stream that SetEncoderProperty is called on is of type MediaStreamType.VideoRecord, then the property is applied directly to the camera. This is true both before and after recording has started.

For non-H.264 cameras, when you call SetEncoderProperty after you get the record or preview started completion callback, the property is set directly on the encoder and is therefore used to configure dynamic encoding properties.

If you call SetEncoderProperty after you issue a call to start recording or previewing and before you get the record or preview started completion callback, you will receive an MF_E_INVALIDREQUEST error since the property cannot be applied to static nor dynamic settings.

To rotate the preview stream, use the GUID defined by MF_MT_VIDEO_ROTATION. See the Media capture using capture device sample for an example of how to do this.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Media::Capture [C++]





See also




© 2014 Microsoft