Skip to main content
MediaCapture.SetEncodingPropertiesAsync | setEncodingPropertiesAsync method

Asynchronously sets the media encoding properties.


mediaCapture.setEncodingPropertiesAsync(mediaStreamType, mediaEncodingProperties, encoderProperties).done( /* Your success and error handlers */ );

public IAsyncAction SetEncodingPropertiesAsync(
  MediaStreamType mediaStreamType, 
  IMediaEncodingProperties mediaEncodingProperties, 
  MediaPropertySet encoderProperties

Public Function SetEncodingPropertiesAsync(
  mediaStreamType As MediaStreamType,  
  mediaEncodingProperties As IMediaEncodingProperties,  
  encoderProperties As MediaPropertySet 
) As IAsyncAction

IAsyncAction^ SetEncodingPropertiesAsync(
  MediaStreamType mediaStreamType, 
  IMediaEncodingProperties^ mediaEncodingProperties, 
  MediaPropertySet^ encoderProperties



Type: MediaStreamType

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


Type: IMediaEncodingProperties

The properties for the media encoding.


Type: MediaPropertySet

The properties for the encoder.

Return value

Type: IAsyncAction

Object that is used to control the asynchronous operation.


This method sets the encoding properties of the encoder that processes the data before it’s passed on to a CaptureElement to be displayed, written out to a IRandomAccessStream or StorageFile, or delivered to a custom media sink. This method does not change the configuration of the source of the data, which is the camera device. It is possible to set the encoding properties to a resolution that is not natively supported by the camera. In this case, the MediaCapture pipeline will use an encoder to perform the conversion to the requested format. Note that this conversion does consume system resources and can result in poor performance or even errors, especially on devices that with limited or no graphics acceleration. For typical scenarios, it is recommended that you choose a resolution supported by the camera that is closest to your desired resolution. You can get a list of a capture device's supported resolutions by calling VideoDeviceController.GetAvailableMediaStreamProperties. For more information, see Set format, resolution, and frame rate for MediaCapture and the Camera Resolution Sample.

To rotate the record or preview stream, use the GUID defined by MF_MT_VIDEO_ROTATION to add metadata to the stream. Note that this rotation is performed by the consumer of the stream, such as the CaptureElement or a video player app, while the actual pixels in the stream still retain their original orientation. For how-to guidance on handling orientation when using the camera, see Handle device orientation with MediaCapture.

To modify the properties of the capture device, use VideoDeviceController.SetMediaStreamPropertiesAsync.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


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



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

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


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



See also

Set format, resolution, and frame rate for MediaCapture
Handle device orientation with MediaCapture
Camera Resolution Sample