spdl.io.get_abuffer_desc¶
- get_abuffer_desc(codec: AudioCodec, *, label: str | None = None, sample_fmt: str | None = None) str [source]¶
Construct
abuffer
filter description that can be used as an audio input toFilterGraph
.See also
https://ffmpeg.org/ffmpeg-filters.html#abuffer: The official documentation for
abuffer
.
Example
path = "foo.mp4" demuxer = spdl.io.Demuxer(path) codec = demuxer.audio_codec decoder = spdl.io.Decoder(codec, filter_desc=None) # use `anull` filter which does nothing for the illustration purpose filter_graph = spdl.io.FilterGraph(f"{get_abuffer_desc(codec)},anull,abuffersink") for packets in demuxer.streaming_demux(duration=1): frames = decoder.decode(packets) filter_graph.add_frames(frames) frames = filter_graph.get_frames()
- Parameters:
codec – The source audio codec
label – Optional Attatch a label to the
abuffer
node, so that it can be referenced later. This makes it easy to refer to the input node when building filter graph with multiple input nodes. Without this argument, FFmpeg will construct a name likeParsed_abuffer_0
.sample_fmt – If provided, override the sample format.
- Returns
The resulting
abuffer
filter expression.