buildAudio

fun buildAudio(description: String, sampleRate: Int, sampleFormat: SampleFormat, channels: Int, timeBase: Rational, outputSampleRate: Int = 0, outputSampleFormat: SampleFormat = SampleFormat.None, outputChannels: Int = 0, channelLayoutMask: Long? = null, outputChannelLayoutMask: Long? = null): FilterGraph

Build a single-input audio graph. When the output* parameters are given, an aformat stage is appended so emitted frames arrive encoder-ready (resampled / reformatted / remixed inside the graph).

The composed chain (the description plus any appended aformat stage) must fit in 2048 bytes. A description that does not leave room is refused with FFmpegError.InvalidArgument; it is never silently truncated.

Parameters

description

filter chain, e.g. volume=0.5,atempo=1.25. Empty or anull means passthrough.

sampleRate

input sample rate

sampleFormat

input sample format (decoder output, e.g. fltp)

channels

input channel count

timeBase

pts time-base of input frames

channelLayoutMask

which speaker each input channel belongs to, as an FFmpeg channel mask; pass the decoded frame's FrameInfo.channelLayoutMask. Null means FFmpeg's default layout for channels, and a frame with another layout, such as 5.1 with side surrounds, is refused by the graph.

outputChannelLayoutMask

the exact layout the output is converted to, when outputChannels alone is ambiguous. Its channel count must equal outputChannels.