Video trancriber
Takes a long video (a local file, or a YouTube/other URL) and produces:
- A full timestamped transcript (
.txtand.srt) - A short overall summary + a chronological list of key moments with timestamps
and quotes (
.mdand.json)
Works well on multi-hour videos because it never asks one model to "watch" the whole thing at once — it transcribes locally with Whisper, then summarizes in 15-minute chunks with Claude, then merges those chunk summaries into one final report.
ffmpeg (required for audio extraction):
# macOS
brew install ffmpeg
# Ubuntu/Debian
sudo apt install ffmpeg
# Windows: download from ffmpeg.org and add to PATHPython packages:
cd video_keymoments
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtAnthropic API key (for the summarization step):
export ANTHROPIC_API_KEY="sk-ant-..." # get one at console.anthropic.comLocal video file:
python main.py --input "/path/to/lecture.mp4" --out ./outputYouTube (or any yt-dlp-supported) URL:
python main.py --input "https://youtube.com/watch?v=XXXXXXXX" --out ./output| Flag | Default | Notes |
|---|---|---|
--model |
medium |
Whisper model size: tiny, base, small, medium, large-v3. Bigger = more accurate but slower. For a 6-7hr video on CPU, start with small or medium; use large-v3 if you have a GPU. |
--chunk-minutes |
15 |
How much transcript gets sent to Claude per summarization call. Smaller = more granular key moments but more API calls. |
--out |
./output |
Where transcript + report files go. |
output/
transcript.txt # full plain-text transcript with timestamps
transcript.srt # subtitle-format transcript
key_moments.json # structured report (video_summary + key_moments[])
key_moments.md # human-readable version of the same report
- Transcription is the slow part. On CPU,
mediummodel runs roughly 2-4x slower than real-time, so a 7-hour video could take several hours. A GPU (even a modest one) speeds this up dramatically —faster-whisperwill use CUDA automatically if available (device="auto"in the script). If you're processing videos like this regularly, it's worth running this on a cloud GPU instance rather than a laptop CPU. - VAD filtering is already on (
vad_filter=True), which skips long silences and can meaningfully cut down processing time for content with dead air (meetings, lectures with pauses, etc). - Cost: transcription is local/free (just compute time). The Claude summarization step costs API tokens proportional to transcript length — a 7-hour video chunked into 15-min windows is ~28 chunk-summary calls plus 1 reduce call, which is inexpensive relative to the transcription time.
The behavior of what gets flagged as a key moment lives entirely in the
prompts in main.py (MAP_SYSTEM_PROMPT and REDUCE_SYSTEM_PROMPT). If
your videos are a specific type — sales calls, lectures, podcasts, sports
broadcasts — edit those prompts to say what actually matters for that
content (e.g. "flag pricing objections and next-step commitments" for
sales calls, or "flag definitions and worked examples" for lectures). This
is the single highest-leverage thing to tune.