Video analysis: download, keyframes, transcripts, thumbnail grids and AI summaries of what's on screen.

0 downloads

dbbasic-video/examples/quick_start.py
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-video.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-video.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-video.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Update README with live PyPI link c32f6df 1 year, 1 month ago History
quick_start.py · 1.2 KB · 43 lines
1#!/usr/bin/env python3
2"""
3Quick start example for dbbasic-video
4
5This example shows how to:
61. Download a YouTube video
72. Extract keyframes
83. Create a thumbnail grid
94. Get the transcript
105. Analyze with AI
11"""
12
13from dbbasic_video.download_video import download_video
14from dbbasic_video.extract_keyframes import extract_keyframes
15from dbbasic_video.make_grid import create_thumbnail_sheet
16from dbbasic_video.get_transcript import download_transcript
17from dbbasic_video.analyze_visuals import analyze_grid
18
19# Configuration
20YOUTUBE_URL = "https://www.youtube.com/watch?v=VIDEO_ID"
21VIDEO_ID = "VIDEO_ID"
22
23# Step 1: Download video
24print("Downloading video...")
25video_file = download_video(YOUTUBE_URL, "my_video.mp4")
26
27# Step 2: Extract keyframes
28print("\nExtracting keyframes...")
29extract_keyframes(video_file, "keyframes/")
30
31# Step 3: Create thumbnail grid
32print("\nCreating thumbnail grid...")
33create_thumbnail_sheet("keyframes/", "thumbnail_grid.jpg")
34
35# Step 4: Download transcript
36print("\nDownloading transcript...")
37download_transcript(VIDEO_ID, "transcript.json")
38
39# Step 5: Analyze visuals (requires OPENAI_API_KEY in .env)
40print("\nAnalyzing visuals with AI...")
41analyze_grid("thumbnail_grid.jpg", "analysis.txt")
42
43print("\n✓ Done! Check the output files.")