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:
codec (AudioCodec, VideoCodec or ImageCodec) – The codec of the incoming packets.
filter_desc (str) – Optional: See
decode_packets()
.decode_config (DecodeConfig) – Optional: See
decode_packets()
.
- Returns:
Decoder instance.