Skip to main content

Process YouTube Command

The process-youtube command downloads a video from YouTube and processes it, extracting frames and analyzing their content. This is similar to the process-video command but works with YouTube URLs instead of local files.

Usage

transfer-learning process-youtube URL [OPTIONS]

Arguments

ArgumentDescription
URLYouTube video URL

Options

OptionDescriptionDefault
--output-dir TEXTOutput directory for resultsdata/
--batch-size INTEGERNumber of frames to process in each batchFrom config
--max-concurrent INTEGERMaximum number of concurrent batchesFrom config
--frame-interval INTEGERInterval between frame extractions in seconds30
--skip-existingSkip processing if output already existsFalse
--forceForce processing even if output already existsFalse
--quality TEXTVideo quality to download (best, 1080p, 720p, etc.)best
--helpShow help message and exit-

Examples

Process a YouTube video

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

Process a YouTube video with custom frame interval

transfer-learning process-youtube "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --frame-interval 10

Process a YouTube video with specific quality

transfer-learning process-youtube "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --quality 720p

Output

The command creates a directory structure in the output directory with the following components:
output_dir/
├── video_title/
│   ├── frames/
│   │   ├── frame_0001.jpg
│   │   ├── frame_0002.jpg
│   │   └── ...
│   ├── metadata.json
│   ├── analysis.json
│   └── video.mp4
  • frames/: Directory containing extracted frames as JPEG images
  • metadata.json: Metadata about the video and extraction process
  • analysis.json: Analysis of the extracted frames
  • video.mp4: The downloaded video file

Metadata Format

The metadata.json file contains information about the video and the extraction process:
{
  "video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "video_title": "Video Title",
  "channel": "Channel Name",
  "upload_date": "20210101",
  "duration": 120.5,
  "frame_count": 10,
  "frame_interval": 30,
  "resolution": {
    "width": 1920,
    "height": 1080
  },
  "fps": 30,
  "extraction_time": "2023-02-25T12:34:56",
  "processing_time": 45.2
}

YouTube URL Formats

The command supports various YouTube URL formats:
  • Standard: https://www.youtube.com/watch?v=VIDEO_ID
  • Short: https://youtu.be/VIDEO_ID
  • With timestamp: https://www.youtube.com/watch?v=VIDEO_ID&t=123s
  • Playlist item: https://www.youtube.com/watch?v=VIDEO_ID&list=PLAYLIST_ID

Next Steps

After processing a YouTube video, you can:
  1. Generate a guide from the processed data
  2. Transcribe the audio from the video
  3. Analyze the content in more detail