Skip to content

A powerful CLI tool for processing videos and generating step-by-step guides using AI. This tool can handle both local video files and YouTube videos, extracting key frames and generating detailed guides using OpenAI's GPT-4 Vision API.

License

Notifications You must be signed in to change notification settings

Wearer-Lab/transfer-learning

Repository files navigation

Transfer Learning Video Processing Pipeline

A powerful CLI tool for processing videos and generating step-by-step guides using AI. This tool can handle both local video files and YouTube videos, extracting key frames and generating detailed guides using OpenAI's GPT-4 Vision API.

Features

  • Process local video files
  • Download and process YouTube videos
  • Extract frames at specified intervals
  • Generate step-by-step guides with AI analysis
  • Beautiful CLI interface with progress tracking
  • Support for both local and YouTube video sources
  • Built-in monitoring and metrics collection
  • Optimized performance with async processing

Installation

  1. Clone the repository:
git clone https://github.com/Wearer-Lab/transfer-learning.git
cd transfer-learning
  1. Create a virtual environment and install dependencies using UV:
python -m venv .venv
source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
pip install uv
uv pip install -e .
  1. Set up your OpenAI API key:
echo "OPENAI_API_KEY=your-api-key-here" > .env

Usage

The CLI provides several commands for different operations:

Process a Local Video

Extract frames from a local video file:

transfer-learning process-video path/to/video.mp4 --output-dir output --batch-size 30

Process a YouTube Video

Download and process a YouTube video:

transfer-learning process-youtube "https://youtube.com/watch?v=VIDEO_ID" --output-dir output

Generate a Guide

Generate a step-by-step guide from processed video frames:

transfer-learning generate-guide output/processed_data --output-dir guides

Complete YouTube Pipeline

Download a YouTube video and generate a guide in one command:

transfer-learning youtube-guide "https://youtube.com/watch?v=VIDEO_ID" --output-dir output

Transcribe Audio

Transcribe audio from a video file:

transfer-learning transcribe path/to/video.mp4 --output-dir transcripts

Analyze Video Content

Analyze video content to extract key information:

transfer-learning analyze path/to/video.mp4 --output-dir analysis

Download Video

Download a video from YouTube or other supported platforms:

transfer-learning download "https://youtube.com/watch?v=VIDEO_ID" --output-dir videos

Command Options

All commands support various options. Use the --help flag to see available options for each command:

transfer-learning process-video --help

Monitoring and Metrics

Transfer Learning includes built-in monitoring capabilities:

  • Metrics Collection: Performance metrics are collected during processing and saved to the metrics directory
  • Logging: Detailed logs are saved to the logs directory
  • Progress Tracking: Rich progress bars and status indicators in the terminal

To view collected metrics:

transfer-learning config --show-metrics

Output Format

The generated guide is saved as a JSON file with the following structure:

{
  "title": "Process Title",
  "description": "Overall process description",
  "steps": [
    {
      "step_number": 1,
      "title": "Step Title",
      "description": "Step description",
      "tools_used": ["tool1", "tool2"],
      "duration": 10.5,
      "key_points": ["point1", "point2"],
      "timestamp": 0.0
    }
  ],
  "principles": [
    {
      "name": "Principle Name",
      "description": "Principle description",
      "importance": "Why this principle matters",
      "examples": ["example1", "example2"]
    }
  ],
  "total_duration": 120.5,
  "source_type": "local",
  "source_path": "path/to/video.mp4"
}

Development

To set up the development environment:

  1. Install development dependencies:
uv pip install -e ".[dev]"
  1. Run tests:
pytest
  1. Check code style:
ruff check .

Project Structure

transfer-learning/
├── data/               # Data storage directory
├── docs/               # Documentation
├── logs/               # Log files
├── metrics/            # Metrics collection
├── src/                # Source code
│   └── transfer_learning/
│       ├── core/       # Core processing modules
│       ├── guide/      # Guide generation
│       ├── models/     # AI model interfaces
│       ├── monitoring/ # Monitoring and metrics
│       ├── utils/      # Utility functions
│       ├── cli.py      # CLI implementation
│       └── config.py   # Configuration
├── tests/              # Test suite
├── .env                # Environment variables
├── pyproject.toml      # Project configuration
└── setup.py            # Package setup

License

This project is licensed under the Eclipse Public License - v 2.0 - see the LICENSE file for details.

About

A powerful CLI tool for processing videos and generating step-by-step guides using AI. This tool can handle both local video files and YouTube videos, extracting key frames and generating detailed guides using OpenAI's GPT-4 Vision API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published