feat: add video input support and related functionality for multimodal models#103
Draft
szw0407 wants to merge 1 commit into
Draft
feat: add video input support and related functionality for multimodal models#103szw0407 wants to merge 1 commit into
szw0407 wants to merge 1 commit into
Conversation
netdur
added a commit
that referenced
this pull request
May 28, 2026
Video support, done the way libmtmd actually allows: a "video" is a
sequence of image frames. libmtmd has no video decoder (only stb_image
for stills and miniaudio for audio), so frame extraction is the
caller's job — LlamaMedia.videoFrames(frames) wraps pre-extracted frame
bytes as one image media item each, to pair with one marker per frame
(EngineChat.addUser inserts the markers automatically).
example/probes/video_describe.dart shows the full flow: ffmpeg extracts
N downscaled frames, videoFrames wraps them, and they go through the
normal multimodal chat path. Verified against
SmolVLM2-256M-Video-Instruct on a real clip — it produces a coherent
description ("A woman is taking a selfie in a store...").
This is the correct alternative to PR #103, whose premise (libmtmd
auto-decodes video) does not hold: routing raw mp4 bytes through the
image path returns null. No MediaKind.video, no dead video-token params.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Done by Claude Haiku from GitHub Colilot.
I am testing whether it works. Hopefully I will open it when I am sure it is correct.