Skip to main content

Analyze videos with multimodal AI, one frame at a time.

Project description

Videoframer for Python

Analyze video with multimodal AI, one frame at a time.

Videoframer extracts chronologically ordered JPEG frames from a local video, groups them into batches, and sends them to OpenAI, Anthropic, or Gemini.

Requirements

  • Python 3.10 or newer
  • FFmpeg available on your system PATH
  • An API key for the selected model provider

Installation

Install support for one provider:

pip install "videoframer[openai]"
pip install "videoframer[anthropic]"
pip install "videoframer[gemini]"

Or install all provider integrations:

pip install "videoframer[all]"

FFmpeg is a system dependency and is not installed by pip. For example:

brew install ffmpeg        # macOS
sudo apt install ffmpeg    # Debian or Ubuntu

Quick start

import os

from videoframer import Videoframer, VideoframerOptions

videoframer = Videoframer(
    VideoframerOptions(
        video_path="./videos/demo.mp4",
        frames_directory="./tmp/frames",
        provider="openai",
        api_key=os.environ["OPENAI_API_KEY"],
        model="gpt-5.6",
        prompt=(
            "Analyze these frames as one continuous video. "
            "Summarize important actions chronologically."
        ),
        frame_rate=1,
        batch_size=5,
        max_frames=20,
    )
)

videoframer.on("progress", print)

analysis = videoframer.analyze()

for batch in analysis.results:
    print(batch.output_text)

frames_directory is a parent directory. Each analysis gets a private, uniquely named videoframer-* subdirectory so concurrent instances cannot overwrite one another's frames. Set keep_frames=True to retain that run directory after analysis. Set max_frames="all", 0, or -1 to analyze every extracted frame.

Lifecycle event payloads are JSON strings. The started, progress, and completed events can be parsed with json.loads; the error event receives the original exception.

Command line

Installing the package provides both videoframer and python -m videoframer:

export OPENAI_API_KEY="..."
videoframer ./videos/demo.mp4 \
  --provider openai \
  --model gpt-5.6 \
  --max-frames 20 \
  --progress

Use ANTHROPIC_API_KEY for Anthropic and GEMINI_API_KEY for Gemini. Analysis JSON is written to standard output; --progress writes lifecycle JSON to standard error.

Video frames are sent to the selected third-party model provider. Review that provider's data handling and retention terms before analyzing sensitive video.

Development

uv sync --all-extras
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mypy
uv run python -m build

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

videoframer-0.1.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

videoframer-0.1.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file videoframer-0.1.0.tar.gz.

File metadata

  • Download URL: videoframer-0.1.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for videoframer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e3bef343da89f0986b88f797be9fd8c44cc87744512cf12ab890508f1645979e
MD5 aea54b485a7317b80e6ff461da67e99d
BLAKE2b-256 6ccc4eac48832155d724920c95577a8dce8f3028f0be778b7714c2f72d6c2c79

See more details on using hashes here.

Provenance

The following attestation bundles were made for videoframer-0.1.0.tar.gz:

Publisher: publish.yml on cacheflow/pyvideoframer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file videoframer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: videoframer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for videoframer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb4ba3f9f926986f71b9ed919ae550dca822f1ad20bcf914dd64038d7c3345b0
MD5 e4bb903e3ee665bda9e933159a2d274e
BLAKE2b-256 4aee9f247c5130143c204b12fcbba2f57efbf592d2c3f560ae3d9529246140d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for videoframer-0.1.0-py3-none-any.whl:

Publisher: publish.yml on cacheflow/pyvideoframer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page