spdl.io.get_buffer_desc

get_buffer_desc(codec: VideoCodec | ImageCodec, label: str | None = None, pix_fmt: str | None = None) str[source]

Construct abuffer filter description that can be used as an video/image input to FilterGraph.

See also

Example

demuxer = spdl.io.Demuxer(sample.path)
codec = demuxer.video_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_buffer_desc(codec)},null,buffersink")

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 video/image codec

  • labelOptional 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 like Parsed_buffer_0.

  • pix_fmt – If provided, override the pixel format.

Returns

The resulting buffer filter expression.