spdl.io.Demuxer

class Demuxer(src: str | bytes | object, **kwargs)[source]

Demuxer can demux audio, video and image from the soure.

Parameters:
  • src – Source identifier. If str type, it is interpreted as a source location, such as local file path or URL. If bytes type, then they are interpreted as in-memory data. If array type (objects implement buffer protocol, such as NumPy NDArray and PyTorch Tensor), then they must be 1 dimentional uint8 array, which contains the raw bytes of the source.

  • demux_config (DemuxConfig) – Custom I/O config.

Methods

demux_audio([window])

Demux audio from the source.

demux_image(**kwargs)

Demux image from the source.

demux_video([window])

Demux video from the source.

has_audio()

Returns true if the source has audio stream.

demux_audio(window: tuple[float, float] | None = None, **kwargs) AudioPackets[source]

Demux audio from the source.

Parameters:

timestamp – A time window. If omitted, the entire audio are demuxed.

Returns:

Demuxed audio packets.

demux_image(**kwargs) ImagePackets[source]

Demux image from the source.

Returns:

Demuxed image packets.

demux_video(window: tuple[float, float] | None = None, **kwargs) VideoPackets[source]

Demux video from the source.

Parameters:

timestamp – A time window. If omitted, the entire audio are demuxed.

Returns:

Demuxed video packets.

has_audio() bool[source]

Returns true if the source has audio stream.