spdl.io.Decoder

Decoder(codec: AudioCodec, *, filter_desc: str | None = _FILTER_DESC_DEFAULT, decode_config: DecodeConfig | None = None) AudioDecoder[source]
Decoder(codec: VideoCodec, *, filter_desc: str | None = _FILTER_DESC_DEFAULT, decode_config: DecodeConfig | None = None) VideoDecoder
Decoder(codec: ImageCodec, *, filter_desc: str | None = _FILTER_DESC_DEFAULT, decode_config: DecodeConfig | None = None) ImageDecoder

Initialize a decoder object that can incrementally decode packets of the same stream.

Example

src = “foo.mp4”

demuxer = spdl.io.Demuxer(src) decoder = spdl.io.Decoder(demuxer.video_codec) for packets in demuxer.streaming_demux_video(num_frames):

frames: VideoFrames = decoder.decode(packets) …

frames: VideoFrames = decoder.flush()

Parameters:
Returns:

Decoder instance.