AudioEncodingProperties AudioEncodingProperties AudioEncodingProperties AudioEncodingProperties AudioEncodingProperties Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

[Contains prerelease APIs.]
Describes the encoding properties of an audio stream.

public : sealed class AudioEncodingProperties : IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingProperties
struct winrt::Windows::Media::MediaProperties::AudioEncodingProperties : IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingProperties
public sealed class AudioEncodingProperties : IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingProperties
Public NotInheritable Class AudioEncodingProperties Implements IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingProperties
var audioEncodingProperties = new audioEncodingProperties();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The encoding quality Auto is a special preset that fills in the proper settings based on the current camera settings. Settings that are manually modified are ignored. For example, if you create a preset profile using one the static create methods, such as CreateWav, and specify Auto as the encoding quality, any changes you make to the properties will be overwritten with values based on the current camera settings.

Note

It is possible to create an AudioEncodingProperties that is not supported on a particular device. For example, you may successfully call CreateMp3, but if an mp3 encoder is not present on the device, attempting to encode audio with the properties returned from this method will fail. For a list of the codecs present by default for each device family, see Supported codecs..

For how-to guidance for setting the encoding properties for captured audio, see Basic photo, video, and audio capture with MediaCapture.

Constructors

AudioEncodingProperties() AudioEncodingProperties() AudioEncodingProperties() AudioEncodingProperties() AudioEncodingProperties()

Creates a new instance of the AudioEncodingProperties class.

public : AudioEncodingProperties()
AudioEncodingProperties() const;
public AudioEncodingProperties()
Public Sub New()
var audioEncodingProperties = new audioEncodingProperties();

Properties

Bitrate Bitrate Bitrate Bitrate Bitrate

Gets or sets the audio bit rate.

public : unsigned int Bitrate { get; set; }
uint32_t Bitrate(); void Bitrate(uint32_t bitrate);
public uint Bitrate { get; set; }
Public ReadWrite Property Bitrate As uint
var uint = audioEncodingProperties.bitrate;
audioEncodingProperties.bitrate = uint;
Value
uint uint uint

The average bit rate of the audio stream, in bits per second.

BitsPerSample BitsPerSample BitsPerSample BitsPerSample BitsPerSample

Gets or sets the number of bits per audio sample.

public : unsigned int BitsPerSample { get; set; }
uint32_t BitsPerSample(); void BitsPerSample(uint32_t bitspersample);
public uint BitsPerSample { get; set; }
Public ReadWrite Property BitsPerSample As uint
var uint = audioEncodingProperties.bitsPerSample;
audioEncodingProperties.bitsPerSample = uint;
Value
uint uint uint

The number of bits per audio sample.

ChannelCount ChannelCount ChannelCount ChannelCount ChannelCount

Gets or sets the number of audio channels.

public : unsigned int ChannelCount { get; set; }
uint32_t ChannelCount(); void ChannelCount(uint32_t channelcount);
public uint ChannelCount { get; set; }
Public ReadWrite Property ChannelCount As uint
var uint = audioEncodingProperties.channelCount;
audioEncodingProperties.channelCount = uint;
Value
uint uint uint

The number of audio channels.

IsSpatial IsSpatial IsSpatial IsSpatial IsSpatial

Gets a value indicating whether the audio is encoded with spatial audio information.

public : Platform::Boolean IsSpatial { get; }
bool IsSpatial();
public bool IsSpatial { get; }
Public ReadOnly Property IsSpatial As bool
var bool = audioEncodingProperties.isSpatial;
Value
bool bool bool

True if the audio is encoded with spatial audio information; otherwise, false.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Properties Properties Properties Properties Properties

Gets additional format properties for the audio stream.

public : MediaPropertySet Properties { get; }
MediaPropertySet Properties();
public MediaPropertySet Properties { get; }
Public ReadOnly Property Properties As MediaPropertySet
var mediaPropertySet = audioEncodingProperties.properties;
Value
MediaPropertySet MediaPropertySet MediaPropertySet

A property set that contains format properties.

Remarks

For information on working with a property set collection, see PropertySet.

SampleRate SampleRate SampleRate SampleRate SampleRate

Gets or sets audio sampling rate.

public : unsigned int SampleRate { get; set; }
uint32_t SampleRate(); void SampleRate(uint32_t samplerate);
public uint SampleRate { get; set; }
Public ReadWrite Property SampleRate As uint
var uint = audioEncodingProperties.sampleRate;
audioEncodingProperties.sampleRate = uint;
Value
uint uint uint

The number of audio samples per second.

Subtype Subtype Subtype Subtype Subtype

Gets or sets the subtype of the format.

public : Platform::String Subtype { get; set; }
winrt::hstring Subtype(); void Subtype(winrt::hstring subtype);
public string Subtype { get; set; }
Public ReadWrite Property Subtype As string
var string = audioEncodingProperties.subtype;
audioEncodingProperties.subtype = string;
Value
string string string

The subtype.

Remarks

The value can be the string representation of a GUID in canonical form, or one of the predefined values listed in the following table.

ValueDescription
"AAC"Advanced Audio Coding (AAC). The stream can contain either raw AAC data or AAC data in an Audio Data Transport Stream (ADTS) stream.
"AC3"Dolby Digital audio (AC-3).
"AACADTS"Advanced Audio Coding (AAC) audio in Audio Data Transport Stream (ADTS) format.
"AACHDCP"AAC in High-Bandwidth Digital Content Protection (HDCP) format.
"AC3"Dolby AC3
"AC3SPDIF"Dolby AC-3 audio over Sony/Philips Digital Interface (S/PDIF).
"AC3HDCP"Dolby AC-3 in High-Bandwidth Digital Content Protection (HDCP) format.
"ADTS"Audio Data Transport Stream
"ALAC"Apple Lossless Audio Codec
"AMRNB"Adaptive Multi-Rate audio codec (AMR-NB)
"AWRWB"Adaptive Multi-Rate Wideband audio codec (AMR-WB)
"DTS"Digital Theater Systems (DTS)
"EAC3"Dolby Digital Plus audio (E-AC-3).
"FLAC"Free Lossless Audio Codec
"Float"Uncompressed 32-bit float PCM audio.
"MP3"MPEG Audio Layer-3 (MP3).
"MPEG"MPEG-1 audio payload.
"OPUS"Opus
"PCM"Uncompressed 16-bit PCM audio.
"WMA8"Windows Media Audio 8 codec, Windows Media Audio 9 codec, or Windows Media Audio 9.1 codec.
"WMA9"Windows Media Audio 9 Professional codec or Windows Media Audio 9.1 Professional codec.
"Vorbis"Vorbis codec

Warning

The string values returned by the MediaEncodingSubtypes properties may not use the same letter casing as AudioEncodingProperties.Subtype, VideoEncodingProperties.Subtype, ContainerEncodingProperties.Subtype, and ImageEncodingProperties.Subtype. For this reason, if you compare the values, you should use a case-insensitive comparison or use hardcoded strings that match the casing returned by the encoding properties.

Type Type Type Type Type

Gets the format type.

public : Platform::String Type { get; }
winrt::hstring Type();
public string Type { get; }
Public ReadOnly Property Type As string
var string = audioEncodingProperties.type;
Value
string string string

The format type. For audio streams, the format type is "Audio".

Methods

Copy() Copy() Copy() Copy() Copy()

Prerelease. Creates a copy of the AudioEncodingProperties object.

public : AudioEncodingProperties Copy()
AudioEncodingProperties Copy() const;
public AudioEncodingProperties Copy()
Public Function Copy() As AudioEncodingProperties
var audioEncodingProperties = audioEncodingProperties.copy();
Returns
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.17095.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)

CreateAac(UInt32, UInt32, UInt32) CreateAac(UInt32, UInt32, UInt32) CreateAac(UInt32, UInt32, UInt32) CreateAac(UInt32, UInt32, UInt32) CreateAac(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Advanced Audio Coding (AAC) audio.

public : static AudioEncodingProperties CreateAac(unsigned int sampleRate, unsigned int channelCount, unsigned int bitrate)
AudioEncodingProperties CreateAac(uint32_t sampleRate, uint32_t channelCount, uint32_t bitrate) const;
public static AudioEncodingProperties CreateAac(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)
Public Static Function CreateAac(sampleRate As UInt32, channelCount As UInt32, bitrate As UInt32) As AudioEncodingProperties
var audioEncodingProperties = Windows.Media.MediaProperties.AudioEncodingProperties.createAac(sampleRate, channelCount, bitrate);
Parameters
sampleRate
UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
UInt32 UInt32 UInt32

The number of audio channels.

bitrate
UInt32 UInt32 UInt32

The audio bit rate.

Returns

CreateAacAdts(UInt32, UInt32, UInt32) CreateAacAdts(UInt32, UInt32, UInt32) CreateAacAdts(UInt32, UInt32, UInt32) CreateAacAdts(UInt32, UInt32, UInt32) CreateAacAdts(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Advanced Audio Coding (AAC) audio in Audio Data Transport Stream (ADTS) format.

public : static AudioEncodingProperties CreateAacAdts(unsigned int sampleRate, unsigned int channelCount, unsigned int bitrate)
AudioEncodingProperties CreateAacAdts(uint32_t sampleRate, uint32_t channelCount, uint32_t bitrate) const;
public static AudioEncodingProperties CreateAacAdts(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)
Public Static Function CreateAacAdts(sampleRate As UInt32, channelCount As UInt32, bitrate As UInt32) As AudioEncodingProperties
var audioEncodingProperties = Windows.Media.MediaProperties.AudioEncodingProperties.createAacAdts(sampleRate, channelCount, bitrate);
Parameters
sampleRate
UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
UInt32 UInt32 UInt32

The number of audio channels.

bitrate
UInt32 UInt32 UInt32

The audio bit rate.

Returns

CreateAlac(UInt32, UInt32, UInt32) CreateAlac(UInt32, UInt32, UInt32) CreateAlac(UInt32, UInt32, UInt32) CreateAlac(UInt32, UInt32, UInt32) CreateAlac(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Apple Lossless Audio Codec (ALAC) audio.

public : static AudioEncodingProperties CreateAlac(unsigned int sampleRate, unsigned int channelCount, unsigned int bitsPerSample)
AudioEncodingProperties CreateAlac(uint32_t sampleRate, uint32_t channelCount, uint32_t bitsPerSample) const;
public static AudioEncodingProperties CreateAlac(UInt32 sampleRate, UInt32 channelCount, UInt32 bitsPerSample)
Public Static Function CreateAlac(sampleRate As UInt32, channelCount As UInt32, bitsPerSample As UInt32) As AudioEncodingProperties
var audioEncodingProperties = Windows.Media.MediaProperties.AudioEncodingProperties.createAlac(sampleRate, channelCount, bitsPerSample);
Parameters
sampleRate
UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
UInt32 UInt32 UInt32

The number of audio channels.

bitsPerSample
UInt32 UInt32 UInt32

The number of bits per sample.

Returns
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

CreateFlac(UInt32, UInt32, UInt32) CreateFlac(UInt32, UInt32, UInt32) CreateFlac(UInt32, UInt32, UInt32) CreateFlac(UInt32, UInt32, UInt32) CreateFlac(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Free Lossless Audio Codec (FLAC) audio.

public : static AudioEncodingProperties CreateFlac(unsigned int sampleRate, unsigned int channelCount, unsigned int bitsPerSample)
AudioEncodingProperties CreateFlac(uint32_t sampleRate, uint32_t channelCount, uint32_t bitsPerSample) const;
public static AudioEncodingProperties CreateFlac(UInt32 sampleRate, UInt32 channelCount, UInt32 bitsPerSample)
Public Static Function CreateFlac(sampleRate As UInt32, channelCount As UInt32, bitsPerSample As UInt32) As AudioEncodingProperties
var audioEncodingProperties = Windows.Media.MediaProperties.AudioEncodingProperties.createFlac(sampleRate, channelCount, bitsPerSample);
Parameters
sampleRate
UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
UInt32 UInt32 UInt32

The number of audio channels.

bitsPerSample
UInt32 UInt32 UInt32

The number of bits per sample.

Returns
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

CreateMp3(UInt32, UInt32, UInt32) CreateMp3(UInt32, UInt32, UInt32) CreateMp3(UInt32, UInt32, UInt32) CreateMp3(UInt32, UInt32, UInt32) CreateMp3(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for MPEG Audio Layer-3 (MP3) audio.

public : static AudioEncodingProperties CreateMp3(unsigned int sampleRate, unsigned int channelCount, unsigned int bitrate)
AudioEncodingProperties CreateMp3(uint32_t sampleRate, uint32_t channelCount, uint32_t bitrate) const;
public static AudioEncodingProperties CreateMp3(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)
Public Static Function CreateMp3(sampleRate As UInt32, channelCount As UInt32, bitrate As UInt32) As AudioEncodingProperties
var audioEncodingProperties = Windows.Media.MediaProperties.AudioEncodingProperties.createMp3(sampleRate, channelCount, bitrate);
Parameters
sampleRate
UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
UInt32 UInt32 UInt32

The number of audio channels.

bitrate
UInt32 UInt32 UInt32

The audio bit rate.

Returns

CreatePcm(UInt32, UInt32, UInt32) CreatePcm(UInt32, UInt32, UInt32) CreatePcm(UInt32, UInt32, UInt32) CreatePcm(UInt32, UInt32, UInt32) CreatePcm(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Pulse Code Modulation (PCM) audio.

public : static AudioEncodingProperties CreatePcm(unsigned int sampleRate, unsigned int channelCount, unsigned int bitsPerSample)
AudioEncodingProperties CreatePcm(uint32_t sampleRate, uint32_t channelCount, uint32_t bitsPerSample) const;
public static AudioEncodingProperties CreatePcm(UInt32 sampleRate, UInt32 channelCount, UInt32 bitsPerSample)
Public Static Function CreatePcm(sampleRate As UInt32, channelCount As UInt32, bitsPerSample As UInt32) As AudioEncodingProperties
var audioEncodingProperties = Windows.Media.MediaProperties.AudioEncodingProperties.createPcm(sampleRate, channelCount, bitsPerSample);
Parameters
sampleRate
UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
UInt32 UInt32 UInt32

The number of audio channels.

bitsPerSample
UInt32 UInt32 UInt32

The audio bit depth.

Returns

CreateWma(UInt32, UInt32, UInt32) CreateWma(UInt32, UInt32, UInt32) CreateWma(UInt32, UInt32, UInt32) CreateWma(UInt32, UInt32, UInt32) CreateWma(UInt32, UInt32, UInt32)

Creates an instance of AudioEncodingProperties for Windows Media Audio (WMA).

public : static AudioEncodingProperties CreateWma(unsigned int sampleRate, unsigned int channelCount, unsigned int bitrate)
AudioEncodingProperties CreateWma(uint32_t sampleRate, uint32_t channelCount, uint32_t bitrate) const;
public static AudioEncodingProperties CreateWma(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)
Public Static Function CreateWma(sampleRate As UInt32, channelCount As UInt32, bitrate As UInt32) As AudioEncodingProperties
var audioEncodingProperties = Windows.Media.MediaProperties.AudioEncodingProperties.createWma(sampleRate, channelCount, bitrate);
Parameters
sampleRate
UInt32 UInt32 UInt32

The audio sampling rate.

channelCount
UInt32 UInt32 UInt32

The number of audio channels.

bitrate
UInt32 UInt32 UInt32

The audio bit rate.

Returns

GetFormatUserData(Byte[]) GetFormatUserData(Byte[]) GetFormatUserData(Byte[]) GetFormatUserData(Byte[]) GetFormatUserData(Byte[])

Gets the media format user data.

public : void GetFormatUserData(Byte[] value)
void GetFormatUserData(Byte[] value) const;
public void GetFormatUserData(Byte[] value)
Public Function GetFormatUserData(value As Byte[]) As void
audioEncodingProperties.getFormatUserData(value);
Parameters
value
Byte[] Byte[] Byte[]

Receives the media format data.

SetFormatUserData(Byte[]) SetFormatUserData(Byte[]) SetFormatUserData(Byte[]) SetFormatUserData(Byte[]) SetFormatUserData(Byte[])

Sets the media format user data.

public : void SetFormatUserData(Byte[] value)
void SetFormatUserData(Byte[] value) const;
public void SetFormatUserData(Byte[] value)
Public Function SetFormatUserData(value As Byte[]) As void
audioEncodingProperties.setFormatUserData(value);
Parameters
value
Byte[] Byte[] Byte[]

The media data to set.

See Also