AudioEncodingProperties AudioEncodingProperties AudioEncodingProperties AudioEncodingProperties Class

Describes the format of an audio stream.

Syntax

Declaration

public sealed class AudioEncodingPropertiespublic sealed class AudioEncodingPropertiesPublic NotInheritable Class AudioEncodingProperties

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(Windows.Media.MediaProperties.AudioEncodingQuality), 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(System.UInt32,System.UInt32,System.UInt32), 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 summary

Creates a new instance of the AudioEncodingProperties class.

Properties summary

Gets or sets the audio bit rate.

Gets or sets the number of bits per audio sample.

Gets or sets the number of audio channels.

Gets additional format properties for the audio stream.

Gets or sets audio sampling rate.

Gets or sets the subtype of the format.

Gets the format type.

Methods summary

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

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

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

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

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

Gets the media format user data.

Sets the media format user data.

Constructors

  • AudioEncodingProperties()
    AudioEncodingProperties()
    AudioEncodingProperties()
    AudioEncodingProperties()

    Creates a new instance of the AudioEncodingProperties class.

    public AudioEncodingProperties()public AudioEncodingProperties()Public Function AudioEncodingProperties() As

Properties

  • Bitrate
    Bitrate
    Bitrate
    Bitrate

    Gets or sets the audio bit rate.

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

    Property Value

    • uint
      uint
      uint
      uint

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

  • BitsPerSample
    BitsPerSample
    BitsPerSample
    BitsPerSample

    Gets or sets the number of bits per audio sample.

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

    Property Value

    • uint
      uint
      uint
      uint

      The number of bits per audio sample.

  • ChannelCount
    ChannelCount
    ChannelCount
    ChannelCount

    Gets or sets the number of audio channels.

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

    Property Value

    • uint
      uint
      uint
      uint

      The number of audio channels.

  • Properties
    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

    Property Value

    Remarks

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

  • SampleRate
    SampleRate
    SampleRate
    SampleRate

    Gets or sets audio sampling rate.

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

    Property Value

    • uint
      uint
      uint
      uint

      The number of audio samples per second.

  • Subtype
    Subtype
    Subtype
    Subtype

    Gets or sets the subtype of the format.

    public string Subtype { get; set; }public string Subtype { get; set; }Public ReadWrite Property Subtype As string

    Property Value

    • string
      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 Subtype, Subtype, Subtype, and 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

    Gets the format type.

    public string Type { get; }public string Type { get; }Public ReadOnly Property Type As string

    Property Value

    • string
      string
      string
      string

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

Methods

  • CreateAac(System.UInt32,System.UInt32,System.UInt32)
    CreateAac(System.UInt32,System.UInt32,System.UInt32)
    CreateAac(System.UInt32,System.UInt32,System.UInt32)
    CreateAac(System.UInt32,System.UInt32,System.UInt32)

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

    public static AudioEncodingProperties CreateAac(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitrate)public static AudioEncodingProperties CreateAac(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitrate)Public Static Function CreateAac(sampleRate As System.UInt32,channelCount As System.UInt32,bitrate As System.UInt32) As AudioEncodingProperties

    Parameters

    • sampleRate
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio sampling rate.

    • channelCount
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The number of audio channels.

    • bitrate
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio bit rate.

    Returns

  • CreateAacAdts(System.UInt32,System.UInt32,System.UInt32)
    CreateAacAdts(System.UInt32,System.UInt32,System.UInt32)
    CreateAacAdts(System.UInt32,System.UInt32,System.UInt32)
    CreateAacAdts(System.UInt32,System.UInt32,System.UInt32)

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

    public static AudioEncodingProperties CreateAacAdts(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitrate)public static AudioEncodingProperties CreateAacAdts(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitrate)Public Static Function CreateAacAdts(sampleRate As System.UInt32,channelCount As System.UInt32,bitrate As System.UInt32) As AudioEncodingProperties

    Parameters

    • sampleRate
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio sampling rate.

    • channelCount
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The number of audio channels.

    • bitrate
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio bit rate.

    Returns

  • CreateMp3(System.UInt32,System.UInt32,System.UInt32)
    CreateMp3(System.UInt32,System.UInt32,System.UInt32)
    CreateMp3(System.UInt32,System.UInt32,System.UInt32)
    CreateMp3(System.UInt32,System.UInt32,System.UInt32)

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

    public static AudioEncodingProperties CreateMp3(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitrate)public static AudioEncodingProperties CreateMp3(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitrate)Public Static Function CreateMp3(sampleRate As System.UInt32,channelCount As System.UInt32,bitrate As System.UInt32) As AudioEncodingProperties

    Parameters

    • sampleRate
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio sampling rate.

    • channelCount
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The number of audio channels.

    • bitrate
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio bit rate.

    Returns

  • CreatePcm(System.UInt32,System.UInt32,System.UInt32)
    CreatePcm(System.UInt32,System.UInt32,System.UInt32)
    CreatePcm(System.UInt32,System.UInt32,System.UInt32)
    CreatePcm(System.UInt32,System.UInt32,System.UInt32)

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

    public static AudioEncodingProperties CreatePcm(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitsPerSample)public static AudioEncodingProperties CreatePcm(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitsPerSample)Public Static Function CreatePcm(sampleRate As System.UInt32,channelCount As System.UInt32,bitsPerSample As System.UInt32) As AudioEncodingProperties

    Parameters

    • sampleRate
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio sampling rate.

    • channelCount
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The number of audio channels.

    • bitsPerSample
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio bit depth.

    Returns

  • CreateWma(System.UInt32,System.UInt32,System.UInt32)
    CreateWma(System.UInt32,System.UInt32,System.UInt32)
    CreateWma(System.UInt32,System.UInt32,System.UInt32)
    CreateWma(System.UInt32,System.UInt32,System.UInt32)

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

    public static AudioEncodingProperties CreateWma(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitrate)public static AudioEncodingProperties CreateWma(System.UInt32 sampleRate,System.UInt32 channelCount,System.UInt32 bitrate)Public Static Function CreateWma(sampleRate As System.UInt32,channelCount As System.UInt32,bitrate As System.UInt32) As AudioEncodingProperties

    Parameters

    • sampleRate
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio sampling rate.

    • channelCount
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The number of audio channels.

    • bitrate
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The audio bit rate.

    Returns

  • GetFormatUserData(System.Byte[])
    GetFormatUserData(System.Byte[])
    GetFormatUserData(System.Byte[])
    GetFormatUserData(System.Byte[])

    Gets the media format user data.

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

    Parameters

    • value
      System.Byte[]
      System.Byte[]
      System.Byte[]
      System.Byte[]

      Receives the media format data.

  • SetFormatUserData(System.Byte[])
    SetFormatUserData(System.Byte[])
    SetFormatUserData(System.Byte[])
    SetFormatUserData(System.Byte[])

    Sets the media format user data.

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

    Parameters

    • value
      System.Byte[]
      System.Byte[]
      System.Byte[]
      System.Byte[]

      The media data to set.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.StaticAttribute

Details

Assembly

Windows.Media.MediaProperties.dll