Skip to main content

vlm-sieve: Python Library for Vision-Language Model (VLM) Video Preprocessing (v0.2.1)

PyPI Package: pip install vlm-sieve | Python Import: from vlmsieve import VideoSieve

Local-First, Zero-GPU Spatial-Temporal Video Gatekeeper & Storyboard Packer for Vision-Language Models (VLMs)

vlm-sieve sits in front of Vision-Language Models (Gemini, GPT-4o, Claude, Qwen-VL, Llama-Vision) to filter out dead air, merge fragmented motion bursts into coherent episodes, crop active Regions-of-Interest (ROIs) with generous context padding, and pack peak-preserving keyframes into composite spatial-temporal storyboards.


What's New in v0.2.1

  1. Bit-Stream Frame Striding (sample_fps=10.0) + Lazy RGB Caching: Uses cap.grab() at the demuxer level to skip intermediate frames without decoding pixel buffers, cutting local CPU preprocessing time by 60%+.
  2. Episode Merging (merge_gap_sec=6.0) + Bridge Frames: Combines adjacent motion bursts separated by brief pauses and retains ~2 FPS bridge frames across merged gaps so multi-second interactions emit a single unified storyboard instead of fragmenting.
  3. Micro-Motion Circular Pre-Roll Buffer (pre_roll_sec=3.0, pre_roll_min_score=0.0025): Captures subtle early approaches (e.g., distant sidewalk footsteps) before the main foreground threshold is crossed.
  4. Hybrid Peak-Preserving Keyframe Sampler: Prevents <1.5s duplicate frames while preserving transient action peaks (such as a 1-second doorbell button press).
  5. Global Camera-Disturbance Classifier (suppress_disturbances=True): Automatically identifies full-frame camera shake or auto-exposure flashes, logs the timestamp in summary.json, and suppresses redundant empty-room storyboard images.
  6. Both-Axis Tile Clamping (tile_max_dim=640) & Wider Context Padding (roi_padding_ratio=0.35): Clamps both max(width, height) per tile and preserves surrounding scene context around objects.

Real-World Provider-Counted Gemini Benchmarks

Measured using provider-reported usage_metadata.prompt_token_count on Gemini 3.8 Flash across both visual-only and full audiovisual (Storyboards + 32kbps MP3 Audio) pipelines:

1. 5m 22s Ring Home Security Footage (1280x720 @ 30 FPS, 9,658 frames)

Pipeline Mode Emitted Payload Provider Input Tokens Input Token Savings Est. API Cost Local CPU Time
Direct Gemini Video Upload Full .webm (322s) 29,403 Baseline $0.02895 N/A (18.3s upload/wait)
vlm-sieve v0.2.1 (Visual-Only) 4 Storyboards + 1 Shake Log 4,823 83.60% saved $0.01197 (58.7% saved) 17.08s
vlm-sieve v0.2.1 (Visual + Audio) 4 Storyboards + 1.2 MB .mp3 12,925 56.04% saved $0.01835 (36.6% saved) 18.34s

2. 40s Vivint Doorbell Footage (720x720 @ 15 FPS, 600 frames)

Pipeline Mode Emitted Payload Provider Input Tokens Input Token Savings Est. API Cost End-to-End Latency
Direct Gemini Video Upload Full .mp4 (40s) 3,659 Baseline $0.00641 19.20s
vlm-sieve v0.2.1 (Visual-Only) 1 Storyboard (1408x1292) 1,292 64.69% saved $0.00431 (32.8% saved) 11.62s (39.5% faster)
vlm-sieve v0.2.1 (Visual + Audio) 1 Storyboard + 157 KB .mp3 2,346 35.88% saved $0.00536 (16.4% saved) 16.04s (16.5% faster)

Installation

pip install -U vlm-sieve

Quickstart (Python API)

from vlmsieve import VideoSieve

sieve = VideoSieve(
    source="security_footage.mp4",
    sample_fps=10.0,
    pre_roll_sec=3.0,
    merge_gap_sec=6.0,
    tile_max_dim=640,
    suppress_disturbances=True,
)

events = sieve.process_video_to_dir("./sieve_output")
report = sieve.get_savings_report()

for ev in events:
    print(
        f"Event {ev.event_id}: {ev.start_time_sec:.2f}s - {ev.end_time_sec:.2f}s | "
        f"Keyframes: {ev.keyframe_times_sec} | Size: {ev.storyboard_pil.size}"
    )

Command-Line Interface (CLI)

vlmsieve ./input_video.mp4 -o ./sieve_output --pre-roll-sec 3.5 --merge-gap-sec 6.0
python -m vlmsieve ./input_video.mp4 -o ./sieve_output

License

MIT License

Metadata

Release files for vlm-sieve 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vlm-sieve 0.2.1
File Size Uploaded Provenance Actions
vlm_sieve-0.2.1.tar.gz 184.1 kB Without provenance Details for vlm_sieve-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vlm-sieve 0.2.1
File Interpreter ABI Platform Actions
vlm_sieve-0.2.1-py3-none-any.whl Python 3 none any Details for vlm_sieve-0.2.1-py3-none-any.whl

Total release size: 205.1 kB

Release files / vlm_sieve-0.2.1.tar.gz

Download URL vlm_sieve-0.2.1.tar.gz
Size 184.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e8f47ed0e76dc759044a954f0b2cc196a84c03f3a1671eb9add0e446b893d36b
BLAKE2b-256 checksum
How to use checksums
98c8506554fd8be38aaabbf2ca6c3e84bc056f5742bfdfd9e5d4d8d29ef5e3f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / vlm_sieve-0.2.1-py3-none-any.whl

Download URL vlm_sieve-0.2.1-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce05e478c6c86a80cae3ce329e009e64449034e56f15e2208709ba795410218f
BLAKE2b-256 checksum
How to use checksums
34130d36070441613175d363058a57062be8921ee37c8d83b58d6fef87007511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Security for vlm-sieve 0.2.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page