IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python class

SampledVideo

SampledVideo​

class max.pipelines.context.SampledVideo(frames, indices, info)

source

Bases: object

The frames kept from a video, and the source they came from.

Frames are held as uint8 (H, W, C) RGB arrays – the form PyAV produces – and converted on request. frame.to_ndarray("rgb24") is pixel-identical to frame.to_image().convert("RGB"), so callers that want images pay only for the wrapper, not a second conversion.

Parameters:

  • frames (list[ndarray[tuple[Any, ...], dtype[uint8]]]) – The sampled frames, in indices order.
  • indices (list[int]) – Source frame index of each entry in frames.
  • info (VideoStreamInfo) – Stream metadata, with num_frames corrected to the count the decode actually produced.

array​

property array: ndarray[tuple[Any, ...], dtype[uint8]]

source

The sampled frames stacked into a (T, H, W, C) uint8 array.

frames​

frames: list[ndarray[tuple[Any, ...], dtype[uint8]]]

source

images​

property images: list[Image]

source

The sampled frames as RGB PIL.Image.Image objects.

indices​

indices: list[int]

source

info​

info: VideoStreamInfo

source