How to Analyze Videos Locally with AI: From Install to First Report
You can analyze a video file with AI models on your own computer, without uploading the footage. A local pipeline decodes the file, picks some of its frames, runs vision and speech models on your CPU or GPU and writes a report. You need network access to install the software and to download model weights, which then stay on your disk.
This guide uses AI-Powered Video Analyzer, a Python command line tool, at version v1.1.0 (commit 313448a) as observed on 2026-11-27. It is installed from a clone of its repository, not from PyPI. Some of its documented steps do not work as written, so the install commands below are based on test installs into an empty virtual environment, and the problems you are likely to hit are named where you will meet them.
What happens to a video on your machine
The stages run one after another. Only the visual stages see frames, and only the audio stages see sound.
The local pipeline, from video file to report
Eight stages in order: frame sampling, object detection, captioning, audio extraction, transcription, audio events, summarization and report writing, each with its input and output.
| stage | input | output | what happens |
|---|---|---|---|
| 1. Decode and sample | video file | selected frames with times | Every frame is decoded; only some are kept for the models. |
| 2. Detect objects | selected frames | labels, scores, boxes | D-FINE through VisionServeX, one frame at a time. |
| 3. Caption (optional) | selected frames | one sentence per frame | BLIP image captioning. Each frame is described on its own. |
| 4. Extract audio | video file | temporary WAV file | Needs moviepy 1.x. The temporary file is removed afterwards. |
| 5. Transcribe (optional) | WAV file | one transcript string | Whisper. Runs whenever it is installed and audio was extracted. |
| 6. Audio events (optional) | WAV file | a status key, no labels | PANNs tagging. In v1.1.0 no sound labels reach the report. |
| 7. Summarize (optional) | transcript, counts, captions | short text | A model served by Ollama receives text only, never the video. |
| 8. Write reports | all results | JSON and Markdown files | A JSON file, a Markdown file and a copy named report.txt. |
Stage 1 of 8, Decode and sample. Input: video file. Output: selected frames with times.
The detector is D-FINE, a transformer based detector that outputs boxes for the 80 COCO classes. It is served by VisionServeX, a separate package. Four presets choose the checkpoint: fast (dfine-n), balanced (dfine-s, the default), quality (dfine-m) and quality+ (dfine-l). The package page for the analyzer summarises these components; where it differs from the commands here, note that this guide reports what happened in test runs.
How the detector predicts its boxes is the subject of D-FINE object detection for video analysis.
By default the sampler keeps about one frame per second and adds frames when the picture changes. A one minute clip therefore does not send all of its frames to any model, and a short event can fall between two samples.
What sampled frames can and cannot show works through that limit with timestamps and measured examples.
Which models are required and which are optional
| Component | Used for | Needed? | Where it comes from |
|---|---|---|---|
| Python 3.10 or later, NumPy, Pillow, headless OpenCV | decoding, sampling, reports | always | base install |
| VisionServeX, PyTorch, Transformers | object detection | by default; --backend none skips detection |
the vision extra gives VisionServeX only |
| PyTorch, Transformers, BLIP weights | captions | optional; --no-captioning |
weights download on first use |
| openai-whisper, moviepy below 2.0, ffmpeg | transcription | optional, but there is no off switch | pip_requirements.txt and your system packages |
| panns-inference, librosa, a CNN14 checkpoint | audio events | optional; no labels in v1.1.0 | pip_requirements.txt; checkpoint added by hand |
| Ollama and a pulled model | written summary | optional; --no-summarization |
separate installation |
First-use downloads differ a lot in size. In the test runs the D-FINE checkpoints were between 15 and 126 MB per preset, the Whisper base model about 145 MB and BLIP about 2 GB, because two weight files of it were fetched.
Install it so that detection actually runs
The README's quick start installs the package with python -m pip install -e ".[vision]". In a clean environment that is not enough at v1.1.0: the extra pulls VisionServeX but neither PyTorch nor Transformers. In the test run on 2026-11-27 every frame failed with missing required modules: transformers, torch, and the command still finished with exit code 0. These lines are from the summary it printed:
Frames : 9 analyzed / 270 total
Preset : balanced model=dfine-s
Detections: 0
Captions : 0
WARNING : No objects detected. Run `ai-video-analyzer doctor` to verify dependencies.
Running ai-video-analyzer doctor in the same environment did not reveal the cause. It printed a tick next to PyTorch not installed (optional — VisionServeX loads its own torch) and finished with Core dependencies OK. Treat doctor as an inventory, not as proof that detection works.
Adding the two missing packages fixes it. The install line at the end of this block is the smallest addition that was verified from an empty virtual environment:
git clone https://github.com/arashsajjadi/ai-powered-video-analyzer.git
cd ai-powered-video-analyzer
git checkout v1.1.0
python -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e ".[vision]" torch transformers
On the test machine (Ubuntu 26.04.1, Python 3.13.12) this environment took about 5.8 GB, mostly because the default Linux build of PyTorch includes GPU libraries. CPU-only wheels, macOS, Windows and other Python versions were not tested. The package pins very little, so you may resolve newer versions than the ones used here: VisionServeX 3.23.0, PyTorch 2.15.0, Transformers 5.24.1 and headless OpenCV 5.1.0.
For the optional stages, use the repository's requirements file and then install the package itself:
python -m pip install -r pip_requirements.txt
python -m pip install -e .
sudo apt install ffmpeg # macOS with Homebrew: brew install ffmpeg
The second line matters. The requirements file installs the dependencies only, so on its own it leaves you without the ai-video-analyzer command. Avoid the full extra as a shortcut: it permits moviepy 2.x, which no longer has the module the audio extractor imports. Audio is then skipped and the report wrongly states No audio track found in video.
First run: detection only
Start without captions, audio events or a summary. Replace video.mp4 with your own file.
ai-video-analyzer analyze video.mp4 --preset balanced \
--no-captioning --no-audio-events --no-summarization -o results
"Detection only" is not exactly what this does. Transcription has no flag, so if Whisper and moviepy are installed, the audio is transcribed as well, and Whisper may download its weights.
On first use, VisionServeX 3.23.0 warns that the dfine-s checkpoint is not cached and suggests pulling it by hand. In the test runs it then downloaded the file anyway, and no manual step was needed.
The test input was a 9 second clip made for this purpose: three public domain or CC0 photographs (a portrait of an astronaut, a cat, a cup of coffee), 3 seconds each with a slow pan, and a synthetic voice. The run on a GPU ended with:
Analysis complete.
Video : cc0_slides.mp4
Duration : 9.0s
Frames : 9 analyzed / 270 total
Preset : balanced model=dfine-s
Detections: 34
Captions : 0
Check the detection count and the limitations list rather than the exit code. Exit code 1 means that the file could not be read or that an unhandled error occurred; a run that detected nothing also exits with 0.
The same run from Python
The configuration class and the function live in submodules; from ai_powered_video_analyzer import analyze_video does not work. This example builds a silent test pattern and disables every model, so it checks the installation of the pipeline code without downloading anything:
import cv2
import numpy as np
from ai_powered_video_analyzer.config import AnalysisConfig
from ai_powered_video_analyzer.core import analyze_video
writer = cv2.VideoWriter("check.avi", cv2.VideoWriter_fourcc(*"MJPG"), 30, (320, 240))
for k in range(90): # 3 s: black, then white
writer.write(np.full((240, 320, 3), 0 if k < 45 else 255, np.uint8))
writer.release()
config = AnalysisConfig(
video_path="check.avi", output_dir="results", backend="none",
enable_captioning=False, enable_audio_events=False, enable_summarization=False,
ollama_model="unused") # skips the model lookup through `ollama list`
report = analyze_video(config)
print(report.sampled_frame_count, "of", report.frame_count, "frames sampled")
print([o["reason"] for o in report.frame_observations])
print(len(report.detections), "detections;", report.limitations)
4 of 90 frames sampled
['periodic', 'periodic', 'scene_change', 'periodic']
0 detections; ['No objects detected (backend=null, model=null). Ensure model weights are available.', 'No audio track found in video.']
Zero detections are expected here because the backend is none. For a real run, remove backend="none" and keep the same check of report.detections and report.limitations.
Read your first report
A run writes three files into the output directory: <name>_analysis.json, <name>_analysis.md and report.txt, a copy of the Markdown that the next run overwrites. Two videos with the same file name also overwrite each other, so give each its own directory.
The Markdown report of the test run listed these detections:
| Label | Count | Max confidence |
|---|---|---|
| spoon | 12 | 0.85 |
| bowl | 5 | 0.57 |
| person | 3 | 0.96 |
| clock | 3 | 0.56 |
| cat | 3 | 0.97 |
| diningtable | 3 | 0.89 |
| cup | 3 | 0.83 |
| refrigerator | 2 | 0.42 |
Read it carefully, because the clip's contents are known:
- Count means boxes summed over sampled frames, not objects. An object detected in three sampled frames is counted at least three times, and several overlapping boxes on it in one frame add more.
- Some labels are wrong. The clip contains no clock. In the first frame a
clockbox and abowlbox have identical coordinates, around the neck ring of the astronaut's suit. The detector scores every candidate box for every class and nothing afterwards removes a second label, so one box can appear under two labels. - A low threshold keeps weak guesses. The default is 0.3. The two
refrigeratorboxes never exceed 0.42. - Labels are spelled as the checkpoint spells them, for example
diningtable.
The preset changes these counts a lot. On the same nine frames, fast produced 64 boxes, balanced 34, quality 21 and quality+ 25. This is not a ranking: the clip has no ground truth, and the checkpoints differ in training data as well as size, since dfine-n was trained on COCO while the other three were also pretrained on Objects365. Start with balanced, then compare presets on footage whose content you know.
The transcript of the same run read: This is a synthetic narration, first departure, then a cat, and finally a cup of coffee. The text that was synthesised says "First a portrait", not "first departure". A report records model output, and it needs checking like any other model output.
One real run: what was on screen and what the report recorded
A nine second timeline. A portrait, a cat and a coffee cup are shown three seconds each. Nine frames are sampled one second apart. Person, cat and cup boxes appear with their slides, and clock boxes appear during the portrait.
| lane | holds |
|---|---|
| On screen (how the clip was built) | portrait |
| Sampled frames | a sampled frame |
| person boxes | person |
| cat boxes | nothing |
| cup boxes | nothing |
| clock boxes (no clock in the clip) | clock |
| event | lane | time | Sampled frames |
|---|---|---|---|
| portrait | On screen (how the clip was built) | 0 to 3 s | frame at 0, 1, 2 s and 1 more |
| cat | On screen (how the clip was built) | 3 to 6 s | frame at 3, 4, 5 s and 1 more |
| coffee | On screen (how the clip was built) | 6 to 9 s | frame at 6, 7, 8 s |
| person | person boxes | 0 s | — |
| person | person boxes | 1 s | — |
| person | person boxes | 2 s | — |
| cat | cat boxes | 3 s | — |
| cat | cat boxes | 4 s | — |
| cat | cat boxes | 5 s | — |
| cup | cup boxes | 6 s | — |
| cup | cup boxes | 7 s | — |
| cup | cup boxes | 8 s | — |
| clock | clock boxes (no clock in the clip) | 0 s | — |
| clock | clock boxes (no clock in the clip) | 1 s | — |
| clock | clock boxes (no clock in the clip) | 2 s | — |
Sampled frames: 9 frames in 9 s (1 per second); visual events without a sampled frame: 0 of 3.
At 0 s. On screen (how the clip was built): portrait. Sampled frames: a sampled frame. person boxes: person. cat boxes: nothing. cup boxes: nothing. clock boxes (no clock in the clip): clock.
To use the JSON file in your own code, see validating, querying and comparing video analysis reports.
Full analysis: captions, speech and a summary
With the full install, drop the --no- flags and name an Ollama model that you have already pulled:
ollama list # pick a model that appears here
ai-video-analyzer analyze video.mp4 --preset balanced --whisper-model base \
--ollama-model <a-model-you-pulled> -o results
Name the model explicitly. Without --ollama-model the tool looks for a few preferred names and otherwise takes the first model that ollama list returns, whatever its type. ollama run, which the tool calls, also downloads a model that is not present locally.
What each added stage gives you:
- Captions. BLIP describes every sampled frame independently. For the first slide the test run produced "a woman in an orange space suit standing in front of an american flag with a space shuttle in the background", three times in a row.
- Transcript. Whisper's text arrives as one string. Segment times are discarded, so the report cannot say when a sentence was spoken.
- Audio events. In v1.1.0 (checked 2026-11-27) this stage returns no sound labels. It reports
model_not_foundwhen no CNN14 checkpoint is present, anderrorwhen one is, because the code does not unpack whatpanns-inferencereturns. Neither is listed underlimitations. - Summary. The text model receives the transcript, the audio-event keys, counts of the ten most frequent labels and the first five captions, with no timestamps. If the call fails, the
summaryfield holds a placeholder sentence instead of staying empty. In the test run, with Ollama 0.20.5, the stored summary also contained terminal escape sequences and duplicated word fragments.
Detection only (three --no- flags) |
Full run | |
|---|---|---|
| Install | vision extra plus PyTorch and Transformers |
requirements file plus the package |
| Frames sampled | same sampler | same sampler |
| Detections | yes | yes |
| Captions | no | one per sampled frame |
| Transcript | whenever Whisper and moviepy are installed | yes |
| Sound labels | no | none in v1.1.0 |
| Written summary | no | needs a running Ollama server |
| First-use downloads | detector weights, and Whisper's if it is installed | detector, BLIP and Whisper weights |
If you need timed speech, offline transcription with Whisper and FFmpeg shows how to get segment times by calling Whisper yourself.
For a summary that keeps times and cites its sources, see local video summarization with timestamped evidence.
Options that do less than their names suggest
At v1.1.0, --summary-style, --save-video and --strict are accepted and then ignored: there is one summary prompt, no annotated video is written and nothing becomes stricter. --confidence can raise the threshold but not lower it, because the detector already discards boxes below 0.3 before the option is applied; a run with --confidence 0.1 produced output identical to the default.
Can it run on a CPU?
Yes. In a check with the GPU hidden and --device cpu, the balanced preset produced the same 34 detections in the same order as the GPU run, with scores differing by at most 0.0085 and the same transcript. This says nothing about speed on your hardware.
CUDA_VISIBLE_DEVICES="" ai-video-analyzer analyze video.mp4 --device cpu \
--no-captioning --no-audio-events --no-summarization -o results_cpu
--device controls the detector only. Hiding the GPU through the environment variable is what keeps BLIP, Whisper and PANNs on the CPU as well. If you request a device that is not available, the detector falls back to the CPU without saying so, and the report does not record which device ran.
For measured detector timings and their limits, see the CPU and GPU benchmark for video object detection.
What leaves your machine, and when
The package contains no upload or telemetry code: your video is decoded and analyzed on your computer. The network is still used, for other things. Installation downloads packages. First use downloads model weights from Hugging Face and OpenAI's servers. Later model loads can contact Hugging Face to check for updates unless you set HF_HUB_OFFLINE=1 and TRANSFORMERS_OFFLINE=1; runs with both set completed here from cached weights. Importing panns-inference, which doctor also does, fetches a label file over plain HTTP if it is missing. And if you point Ollama at a remote host or choose a cloud model, the evidence text, including the transcript, is sent there. No packet capture was made, so this is not a verified offline guarantee. The reports themselves contain the transcript and the input path, so treat them as sensitive if the video is.
Where data goes in a local run and in a cloud upload
A local group holds the video file, the models and the reports. Software and weights flow in from download hosts, and text can leave for a remote language model if one is configured. A separate route uploads the video to hosted models.
| box | boundary | arrows to | detail |
|---|---|---|---|
| Download hosts | — | Local models (get) | Package index, Git and model weight servers. |
| Remote LLM | — | — | Only with a remote Ollama host or a cloud model. |
| Video file | Your computer | Local models; Uploaded video (upload) | — |
| Local models | Your computer | Reports on disk; Remote LLM (text) | Decoding and inference on your computer. |
| Reports on disk | Your computer | — | Contain transcript, captions and input path. |
| Uploaded video | Cloud route | Hosted models | — |
| Hosted models | Cloud route | API response | Inference on the provider's machines. |
| API response | Cloud route | — | — |
8 boxes and 7 arrows. No box is selected.
Command line or desktop GUI?
The command line and the Python API are the current pipeline. The repository also keeps an older Tkinter script, video_processing_gui.py, which is a different program: it detects objects with Ultralytics YOLO11x instead of D-FINE, loads Whisper large-v2 at start-up, takes every n-th frame (32 by default) and writes no JSON report. ai-video-analyzer gui finds it only in a source checkout or an editable install, and it needs ultralytics, pytesseract and psutil, which the gui extra does not list. Ultralytics is licensed under AGPL-3.0. The GUI was not launched for this guide; this description comes from reading its source.
Local analysis or a cloud video API?
| Aspect | This local pipeline | Hosted video API |
|---|---|---|
| Privacy | video stays on your computer | video is sent to the provider under its terms |
| Compute | your CPU or GPU | the provider's |
| Setup | Python environment, several GB of packages and weights | account, key and upload |
| What it can answer | fixed object classes, captions, speech text | depends on the model; often open questions in plain language |
| Typical limits | sampled frames, no tracking, no event recognition | also model dependent, and often sampled too |
| Cost | hardware, power and your time | the provider's pricing |
Choose a local pipeline when the footage may not leave your machine, when you want inspectable intermediate results, or when you will run the same analysis repeatedly without connectivity after setup. Choose a hosted model when the question needs open-ended reasoning that detector labels and per-frame captions cannot support, and you are allowed to send the video.
For interactive viewing, Anastig Vision Lab is a separate, early-access browser workbench that runs a COCO detector on frames sampled from a video and shows a timeline of detection counts. The analyzer neither needs it nor exports to it. Disclosure: the author of this article is also involved in building Anastig.
Licences before you reuse anything
The analyzer declares the MIT licence in its pyproject.toml and README, but on 2026-11-27 the repository had no LICENSE file, so confirm the terms before redistributing it. That declaration does not cover the models. VisionServeX is Apache-2.0. The D-FINE code is Apache-2.0, while its authors warn that checkpoints pretrained on Objects365, which the balanced, quality and quality+ presets use, may be subject to that dataset's terms. BLIP's model card states BSD-3-Clause and also says the release is for research purposes only, Whisper is MIT, and the CNN14 checkpoint is published under CC BY 4.0. Each Ollama model has its own terms.
References
- AI-Powered Video Analyzer, source repository
- Peng, Y., Li, H., Wu, P., et al. D-FINE: Redefine Regression Task in DETRs as Fine-grained Distribution Refinement, 2024.
- Li, J., Li, D., Xiong, C., Hoi, S. BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation, 2022.
- Radford, A., Kim, J. W., Xu, T., et al. Robust Speech Recognition via Large-Scale Weak Supervision, 2022.
- Ollama FAQ
- Hugging Face Hub environment variables