<!-- llms-explorer concept facts · https://llms-explorer.com/tree/llama-cpp-mtmd-lazy-bitmaps-for-frame-by-frame-v/ · pack 2026-10-05 · ~401 tokens -->

# llama.cpp mtmd lazy bitmaps for frame-by-frame video

> mtmd-tokenize-from-parts-per-segment-tokenizatio.md already holds the callback contract (-1 EOF, -2 error, no nested lazy, bitmap or text not both) and the file-hash ID purpose; this file adds only the header text on use and signature.

Parent: [Mac local LLMs: llama.cpp internals](https://llms-explorer.com/tree/mac-local-llms-llama-cpp-internals/) · 1 facets · 4 facts · page: https://llms-explorer.com/tree/llama-cpp-mtmd-lazy-bitmaps-for-frame-by-frame-v/

## Facts

- mtmd-tokenize-from-parts-per-segment-tokenizatio.md already holds the callback contract (-1 EOF, -2 error, no nested lazy, bitmap or text not both) and the file-hash ID purpose; this file adds only the header text on use and signature. — source: `asserted`
- `mtmd_bitmap_init_lazy(ctx, id, user_data, callback)` takes a context, an ID the header says is usually the file hash, and a user pointer; the callback receives `chunk_idx`, `user_data`, `out_bitmap` and `out_text`. — [source](https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/mtmd/mtmd.h)
- A lazy bitmap can expand into one or more chunks, either media or text, and the header states the use as reading video frame by frame without loading the whole video and tracking the video with one ID. — [source](https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/mtmd/mtmd.h)
- Bitmaps and text emitted by the callback are freed automatically; emitted text must be heap-allocated and null-terminated. — [source](https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/mtmd/mtmd.h)
