# Frame-Based Video Analysis Fallback

Used when transcripts are unavailable and local Whisper times out.

## Quick Recipe

```bash
# Download (adjust format as needed)
yt-dlp -f "best[height<=720]" -o "/tmp/video.mp4" "URL"

# Extract frames every 30 seconds, scaled to 480px width
mkdir -p /tmp/frames
ffmpeg -i /tmp/video.mp4 -vf "fps=1/30,scale=480:-1" -q:v 2 /tmp/frames/frame_%04d.jpg

# Count frames
ls /tmp/frames | wc -l
```

## Frame Selection Strategy

| Video Length | Extract Interval | Vision Analysis |
|-------------|----------------|-----------------|
| < 10 min | every 10s | every 1-2 min |
| 10-30 min | every 30s | every ~5 min |
| > 30 min | every 60s | every ~10 min |

**Always analyze Frame 1** — it usually shows the title slide with speaker names and topic.

## Example: Anthropic Prompting 101 Workshop (24 min)

- 50 frames extracted at 30s interval
- Key frames analyzed:
  - Frame 1 (~0:00): Title slide "Prompting 101 / Code w/ Claude", speakers Hannah Moran & Christian Ryan
  - Frame 2 (~1:00): "What is prompt engineering anyway?" definition + 9 skills grid
  - Frame 10 (~5:00): "Prompt Structure" 5-step framework + XML tag example
  - Frame 16 (~8:00): Anthropic Console live demo — Swedish accident report analysis

Result: Full structured summary built from 4 representative frames + known context.

## Pitfalls

- `openai-whisper` often times out on low-resource machines. Do not attempt install mid-session unless bandwidth/storage confirmed.
- `ffmpeg` and `yt-dlp` must be installed. Both are usually available via `pip install yt-dlp` and system package manager.
- Some videos (especially TikTok/Instagram Reels) have aggressive rotation metadata. Add `-noautorotate` to ffmpeg if frames appear sideways.
