Rate this Page
★ ★ ★ ★ ★

AudioStream#

class torchcodec.decoders.AudioStream(demuxer: Demuxer, index: int)[source]#

An audio stream followed by a Demuxer.

You should not build one yourself: a Demuxer creates one for you.

Variables:

index (int) – The stream’s index within the container, absolute across all media types. This is what a Packet’s stream_index can be compared against.

Examples using AudioStream:

Build your own decoding pipeline

Build your own decoding pipeline
property codec_parameters: AudioCodecParameters#

What a decoder needs to know to decode this stream’s packets.

Pass them to a AudioPacketDecoder, or pickle them to build the decoder in another process. To read the stream’s properties, use metadata instead. See AudioCodecParameters.

make_decoder() → AudioPacketDecoder[source]#

[DISCOURAGED]

Still available so that existing code keeps working. The recommended way to build an AudioPacketDecoder is to instantiate it directly, from the stream’s codec parameters: AudioPacketDecoder(stream.codec_parameters).

property metadata: AudioStreamHeaderMetadata#

What the container header says about this audio stream.

From the header only.