Expand description
2026-09-25: Video to patch tensor, the temporal counterpart of
crate::vision_preprocess.
Owner: model-layers (vision input). Invariants:
- Every group of a
PreprocessedVideohas the samegrid_h × grid_wplane, from one target size chosen from the first kept frame. preprocess_videoreturns at least one full temporal group or an error.
The flattened patch dimension is C × temporal_patch_size × patch², so a
patch spans tp frames. A still image fills that axis by repeating itself
tp times (preprocess_image); a video of n sampled frames becomes
grid_t = n / tp temporal groups, each a full patch plane built from tp
consecutive frames. The encoder takes each group as one image. grid_t is
carried, not flattened away, because MRoPE advances T once per group of a
video and holds it constant across an image.
The decoder is chosen by magic bytes, not the declared MIME: GIF decodes
in-process; everything else goes to the opt-in ffmpeg subprocess
(video_decode_ffmpeg).
Structs§
- Preprocessed
Video - 2026-09-25: A decoded, ready-to-encode video.
Constants§
- DEFAULT_
FPS - 2026-09-25: Frames per second to sample at when the caller gives no usable
rate. The Qwen3-VL-30B-A3B checkpoint’s
video_preprocessor_config.jsondeclaresfps: 2. - DEFAULT_
MAX_ FRAMES - DEFAULT_
MIN_ FRAMES - 2026-09-25: Sampling floor and ceiling, as
min_frames: 4andmax_frames: 768in the samevideo_preprocessor_config.json.
Functions§
- decode_
frames - 2026-09-25: Decode every frame of a container, choosing a backend by what the bytes are.
- preprocess_
video - 2026-09-25: Full pipeline: a base64
data:URI holding an animated container becomes temporal groups of patches. - sample_
indices - 2026-09-25: Pick which frame indices to keep so the clip plays at
fps.