AudioEncoderSpec

data class AudioEncoderSpec(val codec: CodecId, val sampleRate: Int, val channels: Int = 2, val sampleFormat: SampleFormat = SampleFormat.None, val bitrateBps: Long, val options: Map<String, String> = emptyMap(), val channelLayoutMask: Long? = null, val encoder: EncoderId? = null)

What an audio encoder writes: the format, the rate, the channels and the sample format. MediaSink.addAudioEncoder opens an encoder from it, and Transcoder.transcode takes one as its audio spec.

Constructors

Link copied to clipboard
constructor(codec: CodecId, sampleRate: Int, channels: Int = 2, sampleFormat: SampleFormat = SampleFormat.None, bitrateBps: Long, options: Map<String, String> = emptyMap(), channelLayoutMask: Long? = null, encoder: EncoderId? = null)

Properties

Link copied to clipboard

The target bit rate in bits per second, for encoders that take one.

Link copied to clipboard

The exact channel layout, as an FFmpeg channel mask, when channels alone is ambiguous: six channels are 5.1 with back surrounds or 5.1 with side surrounds. Its channel count must equal channels. Null uses FFmpeg's default layout for the count, except that Transcoder then copies the source stream's.

Link copied to clipboard

The channel count.

Link copied to clipboard

The format to write.

Link copied to clipboard

The encoder that writes codec; null takes FFmpeg's default for the format. See VideoEncoderSpec.encoder.

Link copied to clipboard

Encoder-specific options, passed through as av_opt_set strings. A key that sets the same thing as a field, such as ar for sampleRate, is refused with FFmpegError.InvalidArgument.

Link copied to clipboard

SampleFormat.None picks the encoder's preferred format (e.g. fltp for aac).

Link copied to clipboard

Samples per second, for each channel.