get_container_metadata#
- torchcodec.decoders.get_container_metadata(source: str | Path | bytes | Tensor | RawIOBase | BufferedReader) ContainerMetadata[source]#
Describe a container and every stream in it, without decoding anything.
metadata = get_container_metadata("video.mp4") metadata.duration_seconds_from_header metadata.streams[metadata.best_video_stream_index].width
Only the header is read, so this is what to reach for before you know what a file holds, and therefore which streams to ask a
Demuxerfor.- Parameters:
source (str,
Pathlib.path, bytes,torch.Tensoror file-like object) – The source of the media, as forDemuxer.- Returns:
The container’s own metadata, plus one entry per stream, indexed by stream index.
- Return type:
Examples using
get_container_metadata: