Quick Start Guide

This guide will walk you through the most common ways to use the Video Analyzer to get your first analysis.

Prerequisites

Ensure you have completed the Installation steps, including: - Installing the CLI tool. - Installing FFmpeg. - Setting up Ollama and pulling the llama3.2-vision model.

Example 1: Local Analysis with Ollama

This is the default and simplest way to run the tool. It uses your local hardware and the Ollama service to perform the entire analysis.

  1. Make sure the Ollama service is running:

    ollama serve
  2. Run the analysis on your video file. Replace video.mp4 with the path to your video:

    video-analyzer video.mp4

The tool will now process the video. You will see log messages indicating the current stage: extracting frames, transcribing audio, analyzing frames, and reconstructing the video description.

Upon completion, the results will be saved in a new output/ directory in a file named analysis.json.

Example 2: Cloud Analysis with an OpenAI-Compatible API

If you prefer to use a cloud service like OpenRouter or have an OpenAI API key, you can offload the LLM processing. This is often faster and can provide access to different models.

This example uses OpenRouter, which offers free access to certain models.

  1. Get an API Key: Sign up at OpenRouter.ai to get your API key.

  2. Run the Analysis Command: Use the --client, --api-key, --api-url, and --model flags to configure the tool.

    video-analyzer video.mp4 \
        --client openai_api \
        --api-key sk-or-v1-your-openrouter-api-key \
        --api-url https://openrouter.ai/api/v1 \
        --model meta-llama/llama-3.2-11b-vision-instruct:free

    Note: For OpenAI's official API, you would use --api-url https://api.openai.com/v1 and a model like --model gpt-4o.

Example 3: Analysis with a Custom Prompt

You can guide the analysis by providing a specific question or instruction using the --prompt flag.

video-analyzer video.mp4 --prompt "What activities are happening in this video?"

This prompt will be injected into the analysis process, influencing both the frame-by-frame descriptions and the final summary to focus on answering your question.

Viewing the Output

After a successful run, you will find an analysis.json file in the output/ directory. The final summary is located under the video_description key.

Sample Output Snippet

The video begins with a person with long blonde hair, wearing a pink t-shirt and yellow shorts, standing in front of a black plastic tub or container on wheels. The ground appears to be covered in wood chips.\n\nAs the video progresses, the person remains facing away from the camera, looking down at something inside the tub. ......

For a complete breakdown of the output file's structure, please see the Output Format documentation.