Skip to main content

Analyze Command

The analyze command performs a comprehensive analysis of a video file or YouTube video, combining frame extraction, content analysis, and audio transcription. This provides a complete understanding of the video content.

Usage

transfer-learning analyze PATH [OPTIONS]

Arguments

ArgumentDescription
PATHPath to video file or YouTube URL

Options

OptionDescriptionDefault
--output-dir TEXTOutput directory for analysis resultsanalysis/
--batch-size INTEGERNumber of frames to process in each batchFrom config
--max-concurrent INTEGERMaximum number of concurrent batchesFrom config
--model TEXTWhisper model to use for transcriptionbase
--device TEXTDevice to use for transcription (cpu, cuda)cpu
--frame-interval INTEGERInterval between frame extractions in seconds30
--skip-existingSkip processing if output already existsFalse
--forceForce processing even if output already existsFalse
--helpShow help message and exit-

Examples

Analyze a local video file

transfer-learning analyze path/to/video.mp4

Analyze a YouTube video

transfer-learning analyze "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Analyze with custom frame interval

transfer-learning analyze path/to/video.mp4 --frame-interval 10

Analyze with specific transcription model

transfer-learning analyze path/to/video.mp4 --model medium

Output

The command creates a comprehensive directory structure with analysis results:
output_dir/
├── video_name/
│   ├── frames/
│   │   ├── frame_0001.jpg
│   │   ├── frame_0002.jpg
│   │   └── ...
│   ├── metadata.json
│   ├── analysis.json
│   ├── transcript.txt
│   ├── summary.json
│   └── video.mp4 (if from YouTube)
  • frames/: Directory containing extracted frames
  • metadata.json: Metadata about the video
  • analysis.json: Frame-by-frame analysis
  • transcript.txt: Audio transcript
  • summary.json: Overall summary of the video content
  • video.mp4: The downloaded video (if from YouTube)

Analysis Process

The analyze command performs the following steps:
  1. If a YouTube URL is provided, downloads the video
  2. Extracts frames at the specified interval
  3. Analyzes each frame using AI vision models
  4. Extracts and transcribes the audio
  5. Combines the frame analysis and transcript to create a comprehensive summary
  6. Saves all results in the output directory

Summary Format

The summary.json file contains a comprehensive summary of the video:
{
  "title": "Video Title",
  "duration": 120.5,
  "frame_count": 10,
  "key_scenes": [
    {
      "timestamp": 0.0,
      "description": "Introduction scene",
      "objects": ["person", "desk", "computer"],
      "actions": ["speaking", "gesturing"]
    }
  ],
  "transcript_summary": "Brief summary of the transcript content",
  "topics": ["topic1", "topic2"],
  "people": ["person1", "person2"],
  "objects": ["object1", "object2"],
  "actions": ["action1", "action2"],
  "sentiment": "positive",
  "technical_quality": {
    "video_quality": "high",
    "audio_quality": "medium",
    "lighting": "good"
  }
}

Use Cases

The analyze command is useful for:
  • Content creators analyzing their videos
  • Researchers studying video content
  • Educators creating accessible materials
  • Marketers understanding video engagement
  • Archivists cataloging video collections