Jaa


MediaCapture.SetEncoderProperty(MediaStreamType, Guid, Object) Method

Definition

Sets an encoding property.

public:
 virtual void SetEncoderProperty(MediaStreamType mediaStreamType, Platform::Guid propertyId, Platform::Object ^ propertyValue) = SetEncoderProperty;
void SetEncoderProperty(MediaStreamType const& mediaStreamType, winrt::guid const& propertyId, IInspectable const& propertyValue);
public void SetEncoderProperty(MediaStreamType mediaStreamType, Guid propertyId, object propertyValue);
function setEncoderProperty(mediaStreamType, propertyId, propertyValue)
Public Sub SetEncoderProperty (mediaStreamType As MediaStreamType, propertyId As Guid, propertyValue As Object)

Parameters

mediaStreamType
MediaStreamType

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

propertyId
Guid

Platform::Guid

winrt::guid

The encoding property to set.

propertyValue
Object

Platform::Object

IInspectable

The new value of the encoding property.

Windows requirements

App capabilities
backgroundMediaRecording microphone webcam

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.

Applies to