Audio​Encoding​Properties Audio​Encoding​Properties Audio​Encoding​Properties Class

Definition

Describes the format of an audio stream.

public sealed class AudioEncodingProperties : IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingPropertiespublic sealed class AudioEncodingProperties : IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingPropertiesPublic NotInheritable Class AudioEncodingProperties Implements IAudioEncodingProperties, IAudioEncodingProperties2, IAudioEncodingPropertiesWithFormatUserData, IMediaEncodingProperties
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()

Creates a new instance of the AudioEncodingProperties class.

public AudioEncodingProperties()public AudioEncodingProperties()Public Sub New()
Attributes

Properties

Bitrate Bitrate Bitrate

Gets or sets the audio bit rate.

public unsigned short Bitrate { get; set; }public uint Bitrate { get; set; }Public ReadWrite Property Bitrate As uint
Value
uint uint uint

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

Attributes

BitsPerSample BitsPerSample BitsPerSample

Gets or sets the number of bits per audio sample.

public unsigned short BitsPerSample { get; set; }public uint BitsPerSample { get; set; }Public ReadWrite Property BitsPerSample As uint
Value
uint uint uint

The number of bits per audio sample.

Attributes

ChannelCount ChannelCount ChannelCount

Gets or sets the number of audio channels.

public unsigned short ChannelCount { get; set; }public uint ChannelCount { get; set; }Public ReadWrite Property ChannelCount As uint
Value
uint uint uint

The number of audio channels.

Attributes

IsSpatial IsSpatial IsSpatial

public PlatForm::Boolean IsSpatial { get; }public bool IsSpatial { get; }Public ReadOnly Property IsSpatial As bool
Value
bool bool bool

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

Attributes
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

Gets additional format properties for the audio stream.

public MediaPropertySet Properties { get; }public MediaPropertySet Properties { get; }Public ReadOnly Property Properties As MediaPropertySet
Value
MediaPropertySet MediaPropertySet MediaPropertySet

A property set that contains format properties.

Attributes

Remarks

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

SampleRate SampleRate SampleRate

Gets or sets audio sampling rate.

public unsigned short SampleRate { get; set; }public uint SampleRate { get; set; }Public ReadWrite Property SampleRate As uint
Value
uint uint uint

The number of audio samples per second.

Attributes

Subtype Subtype Subtype

Gets or sets the subtype of the format.

public PlatForm::String Subtype { get; set; }public string Subtype { get; set; }Public ReadWrite Property Subtype As string
Value
string string string

The subtype.

Attributes

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

Gets the format type.

public PlatForm::String Type { get; }public string Type { get; }Public ReadOnly Property Type As string
Value
string string string

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

Attributes

Methods

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(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)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
Parameters
sampleRate
System.UInt32 System.UInt32 System.UInt32

The audio sampling rate.

channelCount
System.UInt32 System.UInt32 System.UInt32

The number of audio channels.

bitrate
System.UInt32 System.UInt32 System.UInt32

The audio bit rate.

Returns
Attributes

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(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)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
Parameters
sampleRate
System.UInt32 System.UInt32 System.UInt32

The audio sampling rate.

channelCount
System.UInt32 System.UInt32 System.UInt32

The number of audio channels.

bitrate
System.UInt32 System.UInt32 System.UInt32

The audio bit rate.

Returns
Attributes

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(UInt32 sampleRate, UInt32 channelCount, UInt32 bitsPerSample)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
Parameters
sampleRate
System.UInt32 System.UInt32 System.UInt32

The audio sampling rate.

channelCount
System.UInt32 System.UInt32 System.UInt32

The number of audio channels.

bitsPerSample
System.UInt32 System.UInt32 System.UInt32

The number of bits per sample.

Returns
Attributes
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)

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

public static AudioEncodingProperties CreateFlac(UInt32 sampleRate, UInt32 channelCount, UInt32 bitsPerSample)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
Parameters
sampleRate
System.UInt32 System.UInt32 System.UInt32

The audio sampling rate.

channelCount
System.UInt32 System.UInt32 System.UInt32

The number of audio channels.

bitsPerSample
System.UInt32 System.UInt32 System.UInt32

The number of bits per sample.

Returns
Attributes
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)

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

public static AudioEncodingProperties CreateMp3(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)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
Parameters
sampleRate
System.UInt32 System.UInt32 System.UInt32

The audio sampling rate.

channelCount
System.UInt32 System.UInt32 System.UInt32

The number of audio channels.

bitrate
System.UInt32 System.UInt32 System.UInt32

The audio bit rate.

Returns
Attributes

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(UInt32 sampleRate, UInt32 channelCount, UInt32 bitsPerSample)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
Parameters
sampleRate
System.UInt32 System.UInt32 System.UInt32

The audio sampling rate.

channelCount
System.UInt32 System.UInt32 System.UInt32

The number of audio channels.

bitsPerSample
System.UInt32 System.UInt32 System.UInt32

The audio bit depth.

Returns
Attributes

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(UInt32 sampleRate, UInt32 channelCount, UInt32 bitrate)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
Parameters
sampleRate
System.UInt32 System.UInt32 System.UInt32

The audio sampling rate.

channelCount
System.UInt32 System.UInt32 System.UInt32

The number of audio channels.

bitrate
System.UInt32 System.UInt32 System.UInt32

The audio bit rate.

Returns
Attributes

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

Gets the media format user data.

public void GetFormatUserData(Byte[] value)public void GetFormatUserData(Byte[] value)Public Function GetFormatUserData(value As Byte[]) As void
Parameters
value
System.Byte[] System.Byte[] System.Byte[]

Receives the media format data.

Attributes

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

Sets the media format user data.

public void SetFormatUserData(Byte[] value)public void SetFormatUserData(Byte[] value)Public Function SetFormatUserData(value As Byte[]) As void
Parameters
value
System.Byte[] System.Byte[] System.Byte[]

The media data to set.

Attributes

See Also