Rate this Page
★ ★ ★ ★ ★

ContainerMetadata#

class torchcodec.decoders.ContainerMetadata(duration_seconds_from_header: float | None, bit_rate_from_header: float | None, best_video_stream_index: int | None, best_audio_stream_index: int | None, streams: list[StreamMetadata])[source]#

Metadata of a container and of every stream in it.

Unlike DemuxerMetadata, which describes the container alone, this also lists the streams, including the ones that cannot be decoded.

best_audio_stream_index: int | None#

Index of the best stream of audio type (int or None).

best_video_stream_index: int | None#

Index of the best stream of video type (int or None).

bit_rate_from_header: float | None#

Overall bit rate of the container (float or None).

duration_seconds_from_header: float | None#

Duration of the container, in seconds, obtained from the header (float or None).

streams: list[StreamMetadata]#

One entry per stream in the file, indexed by stream index.

A video stream comes back as a VideoStreamHeaderMetadata and an audio stream as an AudioStreamHeaderMetadata. The rest will be plain StreamMetadata. The media_type attribute tells the entries apart.