lmms-video-utils
A codec-stream style video frontend for large multimodal models, modeled
after LLaVA-OneVision-2's codec tokenization. Each video is decoded,
partitioned into adaptive GOPs, and each GOP emits one I-canvas plus a
small number of P-canvases that pack the highest-scoring 2x2 patch blocks
from later frames. The output keeps a patch_positions table aligned with
2D-MRoPE block layouts, so downstream VLMs can place every patch back at
its source (t, h, w).
Install
pip install -e .
pip install -e .[gpu] # add TorchCodec
pip install -e .[all] # everything
PyAV is the default backend for portability; install [gpu] for TorchCodec.
Three usage levels
Level 1 - direct fetch:
from lmms_video_utils import fetch_codec_video
out = fetch_codec_video("clip.mp4", target_canvas=8)
print(out.canvases.shape, out.patch_positions.shape)
Level 2 - qwen-vl-utils-like:
from lmms_video_utils import process_video_info
messages = [{"role": "user", "content": [
{"type": "video", "video": "clip.mp4",
"video_start": 0.0, "video_end": 5.0,
"fps": 2.0, "max_pixels": 100_000},
{"type": "text", "text": "describe"},
]}]
_, videos = process_video_info(messages, video_backend="codec")
Inline keys recognized on each video / video_url item map to
CodecConfig fields:
| Inline key (qwen-vl-utils) | CodecConfig field |
|---|---|
video_start |
start_time |
video_end |
end_time |
fps |
target_fps |
nframes |
max_frames |
max_pixels |
max_pixels |
min_pixels |
min_pixels |
Inline overrides win over defaults passed as kwargs to
process_video_info(messages, **defaults). total_pixels is silently
ignored.
Level 3 - reader object:
from lmms_video_utils import CodecVideoReader
reader = CodecVideoReader("clip.mp4")
for i in range(len(reader)):
canvas = reader[i]
Roadmap
| Feature | Status |
|---|---|
| Uniform GOP, frame-diff scoring, PyAV/TorchCodec backends | implemented |
MV-warp residual scoring (score_mode="mvwarp") |
implemented |
Bit-cost-adaptive GOP (gop_mode="bitcost") + per-frame bit-cost score multiplier |
implemented |
qwen-vl-utils style per-message overrides (process_video_info) |
implemented |
| On-disk caching, batched GPU scoring | planned |
| Optional patched-libav backend for true codec residual | planned |
Metadata
Release files for lmms-video-utils 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lmms_video_utils-0.1.0.tar.gz | 24.2 kB | Without provenance | Details for lmms_video_utils-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lmms_video_utils-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for lmms_video_utils-0.1.0-py3-none-any.whl |
Total release size: 42.8 kB
Release files / lmms_video_utils-0.1.0.tar.gz
| Download URL | lmms_video_utils-0.1.0.tar.gz |
|---|---|
| Size | 24.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7df49f8eb3d3b9c0605324edd78082f30930868e92b592cb15048a11daa5075a
|
|
BLAKE2b-256 checksum How to use checksums |
ce8f6c461ffa0a2e39d04fb33d01fd8f0ade77533e3d8b64d6525e2bcd9f8156
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / lmms_video_utils-0.1.0-py3-none-any.whl
| Download URL | lmms_video_utils-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84165f41622f70f8ea696c0728e2a382f07c67ff46a18b8f18ae4e116bd5079e
|
|
BLAKE2b-256 checksum How to use checksums |
026f9eea437fee0cc5e89ffee9634ba5ad8728e99d0d0cb70bca3685f333d7ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for lmms-video-utils 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.