Add VLM-based semantic footage rating tools - #480
Conversation
Adds four tools that give video libraries semantic understanding with a local vision-language model (Ollama served, e.g. Gemma 4 or Qwen-VL). This covers what static CLIP retrieval cannot: temporal and behavioral semantics. What is included: - vlm_clip_rating: coarse rating of a clip folder (behavior, camera quality, composition, subject visibility, segments, highlights) - vlm_zoom_rating: frame-accurate sub-beat timestamps and deep-dive descriptions for flagged windows - vlm_editorial_ranking: composite scores, leaderboards, and match-cut chains built from the ratings - vlm_comparative_rank: relative ranking of candidate clips with editorial reasoning (shows 4 clips at once for calibrated scores) - vlm-footage-rating skill documenting the workflow - Unit tests for all four tools (Ollama HTTP mocked, no model needed) All stages are idempotent and resume from JSONL output, so re-running after adding footage only processes new clips. Fully local, no API keys.
…el guidance Changes from a portability and model-support audit: - Use the OS temp dir instead of hardcoded /tmp, so the tools work on Windows as well as Linux and macOS. - Add a configurable frame_scale input (320-1280). Smaller values speed up inference and cut VRAM, useful on weak GPUs and with 4b models. - Mark gemma4:12b as the tested and recommended model. Smaller models (gemma3n e2b/e4b, qwen2.5vl 3b/7b) are listed with approximate VRAM but explicitly flagged untested, with guidance on what to expect. - Lower the declared VRAM profile to fit 4GB GPUs (the minimum tier), since the tools support the full model range.
calesthio
left a comment
There was a problem hiding this comment.
Thank you for building a thoughtful local-first footage analysis workflow. I reviewed this against docs/PR_REVIEW_GUIDE.md and ran the focused suite (tests/tools/test_vlm_rating_common.py and tests/tools/test_vlm_rating_tools.py): 29 passed.
I found two runtime-contract blockers before this is merge-ready:
-
Failed clips are treated as successfully processed forever.
vlm_clip_ratingappends an error record containingclip, whileload_rated_ids()treats every record with aclipas complete. A transient Ollama/ffmpeg failure is therefore skipped on every rerun, contrary to the advertised resumability. The zoom pass has the same issue when a clip is written with only failed windows. Please distinguish successful records from retryable failures and add a fail-then-rerun test. -
Availability and locality metadata do not reflect the real runtime. The VLM-backed tools report
AVAILABLEwhen ffmpeg exists even if Ollama is not running or the requested/default vision model is absent. That makes unavailable tools look configured, which the review guide explicitly calls out. Also,supports.local_only/network_required=Falseconflict with accepting an arbitraryollama_urlthat receives base64-encoded user frames. Please either constrain the endpoint to loopback or represent the network/privacy behavior accurately, and make status/setup checks cover the Ollama service/model. (pip install requestsshould also be removed unless it is actually required.)
Please add the guide's registry discovery/status coverage for these four new tools as part of the fix. Once those contracts are accurate, the core implementation and focused test coverage look strong.
calesthio
left a comment
There was a problem hiding this comment.
Thank you for the local VLM footage-rating workflow. Failure records remain retryable, local-only privacy/status contracts are accurate, registry coverage is complete, and CI passes. This is merge-ready.
Summary
Adds semantic video understanding to the footage pipeline using a local
vision-language model (Ollama served, e.g. Gemma 4 12B, Gemma 3n, or
Qwen-VL). CLIP tells you what a frame looks like; these tools tell you
what is actually happening in the clip, how well it was shot, and where
the good moments are.
This came out of a real project: rating 101 dog-walk clips for a product
campaign, where static CLIP retrieval got the context right but could not
tell pulling from calm walking, could not score camera stability, and
could not give cut-precise timestamps. The four tools below solve those
gaps, and are generic enough for any footage library.
What is included
Four new tools in
tools/video/, one shared plumbing module, a skill,and tests:
vlm_clip_ratingfocus_promptfor what the edit cares about.vlm_zoom_ratingvlm_editorial_rankingvlm_comparative_rankvlm-footage-ratingskillDesign notes
clips already processed, so re-runs after adding footage only do the new
clips.
non-numeric timestamps are all tolerated) so one bad response never
kills a batch.
up automatically by the registry.
Testing
One pre-existing test is deselected locally because it hangs in the
project's own
video_compose._mux_external_audio(times out at 180s).That file is untouched by this PR. Flagging it in case you want a
separate look.
Example flow
Then the editor (or an agent) can ask "which clips show the product in a
stable close-up?" and get a ranked, timestamped answer.
Model support and testing
The tools were built and validated against Gemma 4 12B (via Ollama,
gemma4:12b, ~8GB VRAM). That is the recommended model and the default.Smaller vision models (gemma3n e2b/e4b, qwen2.5vl 3b/7b) are NOT yet
tested. They are listed with approximate VRAM figures in the skill so
users on smaller GPUs can try them, with the caveat that JSON conformance
and rating quality may differ. The defensive parsing in
vlm_rating_commonis designed to absorb that drift. Contributionsvalidating a smaller model would be very welcome.