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-1.0.1.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for videoframer-1.0.1.tar.gz
Algorithm Hash digest
SHA256 15f11a0ba599b9b74b016c811b97ad9650524f5291312e99a265a433d5c97db2
MD5 89605c54a46d3a4d28221ddb4c51b5a7
BLAKE2b-256 c1ca37c1023b0fc01b1093c72a287cbc34f51166e2d5bfceae2234abac18a4b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for videoframer-1.0.1.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-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: videoframer-1.0.1-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-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e013c852b956d4589f4eb2c6e601a4d675a1cb08193b4fbc386a21709ddbd87
MD5 f0c79daf45346f00445bb8bd4c3ff552
BLAKE2b-256 9f717f89c6165fffbddd439590791e51939d791da9ea56ce3d4a8ef687c639ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for videoframer-1.0.1-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