Buckets:

|
download
raw
1.73 kB
# utils/video
Browser video loading helpers.
`load_video()` samples frames from a video source into `RawImage` frames so
vision-language models can consume short clips. Video decoding currently
relies on browser media APIs.
## Classes
### RawVideoFrame
A decoded video frame and its timestamp, in seconds.
#### `RawVideoFrame.constructor(image, timestamp)`
Create a video frame.
**Parameters**
- `image` ([`RawImage`](./image#module_utils/image.RawImage)) — The decoded image for this frame.
- `timestamp` (`number`) — The frame timestamp, in seconds.
### RawVideo
A sampled video represented as decoded frames plus total duration.
#### `RawVideo.constructor(frames, duration)`
Create a video from decoded frames.
**Parameters**
- `frames` ([`RawVideoFrame`](./video#module_utils/video.RawVideoFrame)[] | [`RawImage`](./image#module_utils/image.RawImage)[]) — Frames with timestamps, or images to space uniformly across `duration`.
- `duration` (`number`) — Duration in seconds.
#### `RawVideo.width`
Width of the video frames, in pixels.
#### `RawVideo.height`
Height of the video frames, in pixels.
#### `RawVideo.fps`
Effective sampled frame rate.
## Functions
### `load_video(src, [options])`
Load and sample frames from a video.
**Parameters**
- `src` (`string` | `Blob` | `HTMLVideoElement`) — The video to process.
- `options` (`Object`) _optional_ — Optional parameters.
- `num_frames` (`number`) _optional_ — defaults to `null` — The number of frames to sample uniformly.
- `fps` (`number`) _optional_ — defaults to `null` — The number of frames to sample per second.
**Returns:** `Promise`<[`RawVideo`](./video#module_utils/video.RawVideo)> — The loaded video.

Xet Storage Details

Size:
1.73 kB
·
Xet hash:
c2cbf7b434cefcb0939fac0a272fc5647d5758c4a2f0eb2987dcc70418596cdd

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.