MediaCapture.SetEncoderProperty(MediaStreamType, Guid, Object) MediaCapture.SetEncoderProperty(MediaStreamType, Guid, Object) MediaCapture.SetEncoderProperty(MediaStreamType, Guid, Object) MediaCapture.SetEncoderProperty(MediaStreamType, Guid, Object) MediaCapture.SetEncoderProperty(MediaStreamType, Guid, Object) Method

Definition

Sets an encoding property.

public : void SetEncoderProperty(MediaStreamType mediaStreamType, Platform::Guid propertyId, Platform::Object propertyValue)
void SetEncoderProperty(MediaStreamType mediaStreamType, Guid propertyId, winrt::Windows::Foundation::IInspectable propertyValue) const;
public void SetEncoderProperty(MediaStreamType mediaStreamType, Guid propertyId, Object propertyValue)
Public Sub SetEncoderProperty(mediaStreamType As MediaStreamType, propertyId As Guid, propertyValue As Object)
mediaCapture.setEncoderProperty(mediaStreamType, propertyId, propertyValue);

Parameters

mediaStreamType
MediaStreamType MediaStreamType MediaStreamType

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

propertyId
Guid Guid Guid

The encoding property to set.

propertyValue
Object Object Object

The new value of the encoding property.

Additional features and requirements

Capabilities
webcam backgroundMediaRecording microphone

Remarks

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 as MF_MT_VIDEO_ROTATION. For how-to guidance on handling orientation when using the camera, see Handle device orientation with MediaCapture.