VLM Video Temporal Reasoner
The all-in-one temporal reasoner
- frames
- tracks
- scene_state
- summary
- events
- selection
- sampled_frames
- raw_response
- diagnostics_json
- events_json
- selection_json
Most video-VLM workflows fail for the same reason: they feed a model 300 full-res frames and ask for a summary, and the model drowns. VLMVideoTemporalReasoner is the pack's answer to that - a single node that does the whole pipeline itself. It adaptively samples your video down to a few meaningful frames, downsizes them for analysis, runs a real vision-language model, parses the response into validated timestamped events, and hands you summary, events, sampled frames, and diagnostics. No assembly required.
This is the "I want answers about a video without building a five-node chain" node. It's the pack's flagship video-intelligence path, and it's genuinely good at the job: on the pack's own test clip (157 frames, RTX 3090), hybrid sampling picked 12 frames and cut temporal input by over 90% before the model ever ran.
How it works
Four stages, all inside one node:
- Adaptive sampling - it picks frames that matter: scene changes, motion, track changes, plus uniform coverage for safety. The
strategyinput lets you bias it (hybrid is the default; motion-priority and scene-change-priority are there for deterministic experiments).max_framescaps the pick,minimum_gap_secondsstops it from stacking near-identical frames. - Downscale the analysis copy -
analysis_max_side(default 448) shrinks only the frames the VLM sees, keeping tokens low. Zero keeps source resolution. - Inference - it runs one of 12 curated local models (default
SmolVLM2 2.2B Video; pickQwen 3 VL 2Bfor a fast generalist or a larger Qwen for quality).memory_modeswitches between ComfyUI-managed BF16, 4-bit/8-bit bitsandbytes, and CPU. Models download on first run intoComfyUI/models/LLavacheckpoints- Gemma 3 requires accepting its license on Hugging Face, which is why it's not the default. - Strict parsing - the response becomes
VLM_EVENTS, validated against the timestamp/evidence contract. Small models often return "evidence" as positions in the image batch they were given; the parser accepts that only when unambiguous and maps it back to real source indices. Malformed JSON, out-of-range timestamps, bad confidence, duplicate evidence - all rejected whenstrict_outputis on (default).
Inputs worth touching
frames+fps- your video batch (use coreGetVideoComponents/Video Sliceupstream) and its frame rate. Timestamps are wrong without a realfps; don't leave it at 24 if your clip is 30.task/question- action timeline, robotics scene understanding, safety/anomaly monitor, detailed summary, or a free question.max_frames/max_events/max_new_tokens- your budget controls: how many frames to sample, how many events to allow, how long an answer to let the model write.model/memory_mode- the quality/VRAM dial. 2B-class models on a 12GB card are the comfortable default; reach for 4-bit quantization or the 450M edge models before you reach for a bigger GPU.tracks/scene_state(optional) - feed inVLM_TRACKSor a scene state and the reasoner grounds its reasoning in what's already known.
Outputs
summary(STRING) - the human answer.events(VLM_EVENTS) - validated, ordered events with timestamps and evidence; the typed payload forVLMBuildSceneStateor custom automation.selection(VLM_VIDEO_SELECTION) - the exact sampled-frame mapping.sampled_frames(IMAGE) - see what the model actually saw.raw_response,diagnostics_json,events_json,selection_json- the raw model output and machine-readable versions of everything.
That's the killer feature honestly: you get the pretty answer and the receipts, without re-running anything.
Install
Part of ComfyUI VLM Nodes (gokayfem/ComfyUI_VLM_nodes). ComfyUI Manager → search "VLM Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/gokayfem/ComfyUI_VLM_nodes
python -m pip install -r ComfyUI/custom_nodes/ComfyUI_VLM_nodes/requirements.txt
Run pip with ComfyUI's Python, and never let the repo install or replace torch. First execution downloads your chosen model (respects HF_TOKEN); quantized modes pull official bitsandbytes wheels automatically on supported platforms.
Gotchas
unload_after defaults to false, which caches the model per node instance for fast re-runs - flip it on if a second big model must run right after. enable_thinking stays off for latency; turn it on when a task genuinely needs reasoning before answering. And the biggest one: don't fight the validation. If strict_output errors, it's usually telling you the model went off-contract - switch to a structured-output-capable model (the Qwen 3 VL family is the reliable one) rather than weakening validation to accept garbage.
Inputs (20)
| Name | Type | Default | Description |
|---|---|---|---|
| frames | IMAGE | — | |
| fps | FLOAT | 24.000.01–1000 | — |
| task | COMBO | Action timeline | 5 options: Action timeline, Robotics scene understanding, Safety and anomaly monitor, Detailed temporal summary, Answer a question |
| question | STRING | What changes over time? | — |
| model | COMBO | SmolVLM2 2.2B Video | 12 options: Qwen 3.5 0.8B (fastest current), Qwen 3.5 4B (recommended), Qwen 3 VL 2B Instruct, Qwen 3 VL 4B Instruct, Qwen 3 VL 8B Instruct, SmolVLM2 500M Video (low VRAM), +6 |
| custom_model_id | STRING | — | |
| memory_mode | COMBO | ComfyUI managed (BF16) | 4 options: ComfyUI managed (BF16), 4-bit NF4 (bitsandbytes), 8-bit (bitsandbytes), CPU |
| max_frames | INT | 161–512 | — |
| max_events | INT | 241–256 | — |
| max_new_tokens | INT | 76832–16384 | — |
| tracksopt | VLM_TRACKS | — | |
| scene_stateopt | VLM_SCENE_STATE | — | |
| strategyopt | COMBO | Hybrid: scene + motion + tracks | 5 options: Hybrid: scene + motion + tracks, Uniform coverage, Motion priority, Scene-change priority, Track-change priority |
| minimum_gap_secondsopt | FLOAT | 0.150–60 | — |
| analysis_max_sideopt | INT | 4480–4096 | Downscale sampled frames before the VLM. 0 keeps the source resolution; 448 is the fast default. |
| attention_modeopt | COMBO | Auto (SDPA) | 3 options: Auto (SDPA), Flash Attention 2, Eager |
| enable_thinkingopt | BOOLEAN | false | — |
| strict_outputopt | BOOLEAN | true | — |
| unload_afteropt | BOOLEAN | false | — |
| stream_outputopt | BOOLEAN | true | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| summary | STRING | — |
| events | VLM_EVENTS | — |
| selection | VLM_VIDEO_SELECTION | — |
| sampled_frames | IMAGE | — |
| raw_response | STRING | — |
| diagnostics_json | STRING | — |
| events_json | STRING | — |
| selection_json | STRING | — |