VideoReader
A lazily opened video: open() reads the header only, info reports the stream's VideoInfo, and the frame getters decode on demand, so a long clip is read per index or in batches without decoding the whole of it (load_video decodes everything at once). frames_at(indices) is the primitive every other getter routes through; a custom sampling policy computes its indices against info and calls it. A reader releases its decoder state when the object is garbage collected; it has no close() and is not a context manager.
info (property)
The stream's VideoInfo, read at open; no frame is decoded.
FrameRange
FrameRangeA lazy pass over a reader's frames in windows of up to batch_size frames: each step decodes its window and yields a FrameBatch. VideoReader.frames() returns one; iterate it once. The range keeps its reader alive.
A lazy pass over a reader's frames in windows of up to batch_size frames: each step decodes its window and yields a FrameBatch. VideoReader.frames() returns one; iterate it once. The range keeps its reader alive.
__init__
__init__(self, /, *args, **kwargs)
Initialize self. See help(type(self)) for accurate signature.
frame_bytes
frame_bytesframe_bytes(self, index: int) -> bytes
frame_bytes(self, index: int) -> bytes
frame_bytes(index) -> bytes
One frame's raw RGB bytes, H * W * 3 of them in row order; the same values as frames_at([index]).frames.
frames
framesframes(self, batch_size: int = 1) -> clika_runtime._core.io.VideoReader.FrameRange
frames(self, batch_size: int = 1) -> clika_runtime._core.io.VideoReader.FrameRange frames(self, indices: collections.abc.Sequence[int], batch_size: int = 1) -> clika_runtime._core.io.VideoReader.FrameRange
Overloaded function.
frames(self, batch_size: int = 1) -> clika_runtime._core.io.VideoReader.FrameRange
frames(batch_size=1) -> VideoReader.FrameRange
Iterate every frame of the clip, in order, in FrameBatch windows of up to batch_size frames (a value under 1 reads as 1); each window decodes when the iteration reaches it.
frames(self, indices: collections.abc.Sequence[int], batch_size: int = 1) -> clika_runtime._core.io.VideoReader.FrameRange
frames(indices, batch_size=1) -> VideoReader.FrameRange
Iterate the frames at indices, in the given order, in windows of up to batch_size; an index past the clip's last frame raises InvalidArgumentError when its window decodes.
frames_at
frames_atframes_at(self, indices: collections.abc.Sequence[int]) -> clika_runtime._core.io.FrameBatch
frames_at(self, indices: collections.abc.Sequence[int]) -> clika_runtime._core.io.FrameBatch
frames_at(indices) -> FrameBatch
Decode exactly the frames at indices, in the given order. An index past the clip's last frame raises InvalidArgumentError naming it.
frames_at_timestamps
frames_at_timestampsframes_at_timestamps(self, seconds: collections.abc.Sequence[float]) -> clika_runtime._core.io.FrameBatch
frames_at_timestamps(self, seconds: collections.abc.Sequence[float]) -> clika_runtime._core.io.FrameBatch
frames_at_timestamps(seconds) -> FrameBatch
Decode the frame nearest each timestamp in seconds, in the given order.
open
openopen(source: object) -> clika_runtime._core.io.VideoReader
open(source: object) -> clika_runtime._core.io.VideoReader
open(source) -> VideoReader
Open a clip and read its header: source is a path (a str or an os.PathLike) or the encoded clip as bytes, a bytearray or a memoryview, which the reader copies, so the object is free to go. Raises on a missing or unreadable file, and when no decode backend exists (video_capability() is False).
sample_uniform
sample_uniformsample_uniform(self, n: int) -> clika_runtime._core.io.FrameBatch
sample_uniform(self, n: int) -> clika_runtime._core.io.FrameBatch
sample_uniform(n) -> FrameBatch
Decode n frames spread evenly across the whole clip, the first one at index 0.
to_process_metadata
to_process_metadatato_process_metadata(self) -> clika_runtime._core.io.VideoInfo
to_process_metadata(self) -> clika_runtime._core.io.VideoInfo
to_process_metadata() -> VideoInfo
The same VideoInfo as info, in the form a video processor's metadata argument takes.