DBBasic Video
AI-powered video analysis toolkit for extracting, analyzing, and summarizing video content.
Features
- 📥 Download videos from YouTube
- 🎬 Extract keyframes using scene detection
- 📝 Get transcripts automatically
- 🖼️ Create thumbnail grids from keyframes
- 🤖 AI analysis of visual content using GPT-4 Vision
- 📊 Comprehensive summaries combining visuals and transcripts
Installation
pip install dbbasic-video
Or install from source:
git clone https://github.com/askrobots/dbbasic-video.git
cd dbbasic-video
pip install -e .
Requirements
- Python 3.8+
- OpenAI API key (set as
OPENAI_API_KEYenvironment variable or in.envfile) - yt-dlp (for downloading videos)
Quick Start
Complete Pipeline
Run the entire analysis pipeline on a YouTube video:
dbbasic-video pipeline "https://www.youtube.com/watch?v=VIDEO_ID"
This will:
- Download the video
- Extract keyframes from scene changes
- Create a thumbnail grid
- Download the transcript
- Analyze visuals with AI
- Generate a comprehensive summary
Individual Commands
Download a video:
dbbasic-video download "https://www.youtube.com/watch?v=VIDEO_ID" -o video.mp4
Extract keyframes:
dbbasic-video extract video.mp4 -o keyframes/
Get transcript:
dbbasic-video transcript VIDEO_ID
Create thumbnail grid:
dbbasic-video grid keyframes/ -o thumbnail_grid.jpg
Analyze visuals:
dbbasic-video analyze thumbnail_grid.jpg -o analysis.txt
Find best thumbnail:
dbbasic-video find-thumbnail keyframes/ -t 120.5
Create comprehensive summary:
dbbasic-video summarize transcript.json analysis.txt -o summary.txt
Environment Variables
Create a .env file in your working directory:
OPENAI_API_KEY=your_api_key_here
Output Structure
When running the pipeline, output is organized as:
output/
├── video.mp4 # Downloaded video
├── keyframes/ # Extracted keyframes
│ ├── scene_0001_*.jpg
│ ├── scene_0002_*.jpg
│ └── scenes_metadata.txt
├── thumbnail_grid.jpg # Grid of all keyframes
├── transcript.json # Raw transcript
├── transcript.txt # Readable transcript
├── visual_analysis.txt # AI visual analysis
└── comprehensive_summary.txt # Final summary
API Usage
from dbbasic_video.extract_keyframes import extract_keyframes
from dbbasic_video.make_grid import create_thumbnail_sheet
from dbbasic_video.analyze_visuals import analyze_grid
# Extract keyframes
extract_keyframes("video.mp4", "keyframes/")
# Create thumbnail grid
create_thumbnail_sheet("keyframes/", "grid.jpg")
# Analyze with AI
analyze_grid("grid.jpg", "analysis.txt")
Cost Considerations
- Scene detection and keyframe extraction: Free (local processing)
- Transcript download: Free (from YouTube)
- AI visual analysis: ~$0.01-0.02 per image with GPT-4 Vision
- Using thumbnail grid: 1 API call instead of analyzing each frame individually
License
MIT
Future: DBBasic Core Integration
This package is designed to be part of the larger DBBasic ecosystem. In the future, a unified db-basic CLI will provide:
# Unified configuration
db-basic config set output_dir ~/analysis
# Plugin-based architecture
db-basic video extract video.mp4 # uses dbbasic-video
db-basic audio transcribe audio.mp3 # uses dbbasic-audio
db-basic image analyze photo.jpg # uses dbbasic-image
# Plugin discovery
db-basic list
✓ video (dbbasic-video 0.1.0)
✓ audio (dbbasic-audio 0.2.1)
✗ image (not installed - pip install dbbasic-image)
Planned shared infrastructure:
- Global config:
~/.config/dbbasic/config.toml - Shared cache and output structure
- Unified logging and error handling
- Plugin registry and version management
- Common utilities for AI, media processing, and data handling
For now, dbbasic-video works as a standalone tool. When db-basic core is released, it will automatically integrate while maintaining backwards compatibility.
Contributing
Contributions welcome! Please open an issue or PR.
Release files for dbbasic-video 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dbbasic_video-0.1.0.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dbbasic_video-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.4 kB
Release files / dbbasic_video-0.1.0.tar.gz
| Download URL | dbbasic_video-0.1.0.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07fa7a3f81780099ac107986229f17fdb1834483e4ba83e76b2cc9d1074c99f7
|
|
BLAKE2b-256 checksum How to use checksums |
ff8d16589c69b654bd6f4c7afdb465d1150447ac17b57aa1a232e9051833dbe8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.1
|
Release files / dbbasic_video-0.1.0-py3-none-any.whl
| Download URL | dbbasic_video-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f67b309ac5eb3956c998d42b174fc669f7f62521dfc5aa0220804f864222ff89
|
|
BLAKE2b-256 checksum How to use checksums |
a1328d338f3c1eb91866268a1c9e6486946fd55284f28754d1f8f110bf2190fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.1
|