A workflow demonstrating how the Video Agent can analyze video content, detect objects, and extract meaningful information.

Quick Start

1

Install Package

First, install the PraisonAI Agents package:

pip install praisonaiagents
2

Set API Key

Set your OpenAI API key as an environment variable:

export OPENAI_API_KEY=your_api_key_here
3

Create Script

Create a new file video_analyzer.py:

from praisonaiagents import Agent, Task, PraisonAIAgents

# Create Video Analysis Agent
video_agent = Agent(
    name="VideoAnalyst",
    role="Video Analysis Specialist",
    goal="Analyze videos to extract meaningful information",
    backstory="""You are an expert in computer vision and video analysis.
    You excel at describing content, detecting objects, and understanding context.""",
    llm="gpt-4o-mini",
    self_reflect=False
)

# Create video analysis task
analysis_task = Task(
    name="analyze_video",
    description="""Analyze this video and provide:
        1. Summary of main events
        2. Key objects and people
        3. Text and important information
        4. Context and setting""",
    expected_output="Comprehensive video analysis",
    agent=video_agent,
    images=["video.mp4"]
)

# Create PraisonAIAgents instance
agents = PraisonAIAgents(
    agents=[video_agent],
    tasks=[analysis_task],
    process="sequential",
    verbose=1
)

# Run analysis
agents.start()

Understanding Video Analysis

The Video Agent combines multiple capabilities for comprehensive video understanding:

  1. Content Analysis: Analyzes video scenes and events
  2. Object Detection: Identifies objects and people
  3. Text Extraction: Captures text shown in videos
  4. Context Understanding: Interprets settings and situations

Features

Scene Analysis

Detailed analysis of video scenes.

Object Detection

Identification of objects and people.

Text Extraction

Capture of text and captions.

Context Analysis

Understanding of video context.

Example Usage

# Example: Analyze a presentation video
from praisonaiagents import Agent, Task, PraisonAIAgents

video_agent = Agent(
    name="VideoAnalyst",
    role="Video Analysis Specialist",
    goal="Extract information from presentation videos",
    llm="gpt-4o-mini"
)

# Create presentation analysis task
presentation_task = Task(
    name="analyze_presentation",
    description="""Analyze this presentation video:
        1. Extract key points
        2. Capture slide content
        3. Note speaker's main arguments
        4. Summarize Q&A session""",
    expected_output="Detailed presentation summary",
    agent=video_agent,
    images=["presentation.mp4"]
)

# Run analysis
agents = PraisonAIAgents(
    agents=[video_agent],
    tasks=[presentation_task],
    process="sequential"
)
agents.start()

Next Steps

Was this page helpful?