Skip to main content
Vane Data / Reference

read_video_frames

read_video_frames streams selected frames as rows, with data: IMAGE('RGB', image_height, image_width). It returns a Relation and emits one row per frame rather than one row per input.

Signature

example.py
vane.read_video_frames(
    path, image_height, image_width, is_key_frame=None,
    *, sample_interval_seconds=None, start_time=0, end_time=None,
    max_input_bytes=8589934592, max_decoded_frames=1000000, max_pixels=33554432,
    max_partition_bytes=10485760, frame_limit=None, read_task_count=None,
    on_error="raise", indexes=None, connection=None,
) -> Relation

SQL: read_video_frames(source, height, width [, is_key_frame], start_time => ..., ...).

Parameters

NameTypeDescriptionDefault
pathPath string, os.PathLike, FILE/VIDEOFILE value, or a list of theseExact input paths or FILE views; no directory or glob discoveryRequired
image_height / image_widthPositive integerOutput frame dimensions; data is IMAGE('RGB', H, W)Required
is_key_framebool or NoneTrue selects keyframes, False selects non-keyframes, and None disables this filterNone
sample_interval_secondsNumber or NoneEmit frames when timestamps reach the next interval targetNone
start_time / end_timeNumberInclusive time window in seconds relative to stream start0 / None
max_input_bytesIntegerEncoded logical-view limit8 GiB (maximum 16 GiB)
max_decoded_framesIntegerPer-file decoding limit, including filtered frames1,000,000
max_pixelsIntegerInput and output pixel limit32 Mi pixels
max_partition_bytesIntegerHard emitted batch payload budget10 MiB (maximum 256 MiB)
frame_limitInteger or NoneGlobal ordered frame cap; uses one ordered work unitNone
read_task_countInteger or NoneBalanced file groups for local tasks and Ray splits, capped at the file countOne group per file
on_error"raise" / "skip""skip" suppresses only encoded-format failures"raise"
indexesList of index BLOBs or NoneVerified keyframe-seeking indexes, one per inputNone
connectionConnection or NoneQuery session executing the scanCurrent connection

Returns and errors

Returns one row per selected frame: path, the original file view, frame_index, frame_time, time-base and timestamp fields (frame_pts, frame_dts, frame_duration), is_key_frame, and data. A top-level NULL/None or empty list yields an empty table with the declared schema; NULL list elements and other FILE subtypes are rejected. Binding validates arguments without opening the videos. Row order across file tasks is unspecified; use ORDER BY when needed.

Example

example.py
import vane


con = vane.connect()
frames = vane.read_video_frames(
    "clip.mp4", 224, 224,
    start_time=1, end_time=5, sample_interval_seconds=0.5,
    connection=con,
)
frames.select("path", "frame_index", "frame_time", "data").show()