Drowning in 2-Hour Technical Keynotes?
We’ve all been there. You find a 90-minute deep dive from AWS re:Invent or a GopherCon talk that looks promising. You need that one specific architectural decision buried at the 45-minute mark, but you don’t have the time to sit through the fluff. Manually scrubbing through a timeline is a recipe for frustration.
I built a custom automation pipeline to solve this. By combining media processing, local speech-to-text, and targeted prompt engineering, you can turn a massive video into a 30-second read. This isn’t just about saving time; it’s about building a searchable knowledge base from audio that was previously locked away in a video format.
The 5-Minute Setup
You don’t need a massive server to run this. A standard laptop will do, provided you have ffmpeg installed for the heavy lifting of audio extraction.
1. Install System Dependencies
If you’re on macOS, Homebrew makes this easy:
brew install ffmpeg
For Ubuntu or Debian users:
sudo apt update && sudo apt install ffmpeg
2. Prepare the Python Environment
Keep your global environment clean by using a virtual environment. You’ll need yt-dlp to handle the YouTube stream, openai-whisper for the transcription, and the openai SDK for the final summary.
python -m venv venv
source venv/bin/activate
pip install yt-dlp openai-whisper openai
3. The Core Script
Save the following as summarize.py. This script downloads the audio, runs the Whisper model locally on your CPU or GPU, and then pings an LLM for the highlights.
import yt_dlp
import whisper
import os
from openai import OpenAI
# Quick Config
VIDEO_URL = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
client = OpenAI(api_key="your_key_here")
def download_audio(url):
opts = {
'format': 'm4a/bestaudio/best',
'postprocessors': [{'key': 'FFmpegExtractAudio', 'preferredcodec': 'm4a'}],
'outtmpl': 'temp_audio.%(ext)s',
}
with yt_dlp.YoutubeDL(opts) as ydl:
ydl.download([url])
return "temp_audio.m4a"
def transcribe(path):
# The 'base' model is ~140MB and runs fast on most CPUs
model = whisper.load_model("base")
return model.transcribe(path)["text"]
def summarize(text):
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a technical editor. Extract key architectural decisions and CLI commands into bullet points."},
{"role": "user", "content": text}
]
)
return response.choices[0].message.content
# Run the pipeline
print("Step 1: Extracting audio...")
audio_path = download_audio(VIDEO_URL)
print("Step 2: Transcribing (Local Whisper)... ")
raw_text = transcribe(audio_path)
print("Step 3: Generating summary...")
print("\n--- RESULTS ---\n", summarize(raw_text))
Why This Stack Works
Each component in this pipeline serves a specific purpose, balancing cost and performance.
Efficient Extraction with yt-dlp
Downloading a 4K video just to hear the speaker is a waste of bandwidth. By targeting the m4a audio stream, we reduce the download size from 500MB to maybe 15MB. yt-dlp is essential here because it handles YouTube’s frequent signature changes far better than older libraries like pytube.
Local Transcription with Whisper
Whisper runs entirely on your hardware. This means your data stays private and you don’t pay per-minute transcription fees. While the base model is incredibly fast, it might struggle with heavy accents. If you’re transcribing a complex talk on Kubernetes networking, try upgrading to the small or medium models. They require more RAM (around 2GB to 5GB) but provide much higher accuracy for technical jargon.
The Logic Layer: GPT-4o-mini
Raw transcripts are messy. They are full of “umms,” “likes,” and repeated phrases that clutter the message. Using gpt-4o-mini is a smart move because it’s roughly 20x cheaper than the full GPT-4o model while still being more than capable of distilling a transcript into clean bullet points.
Overcoming Common Roadblocks
Once you start processing longer videos, you’ll hit a few predictable walls. Here is how to scale the script.
Managing Large Contexts
Even though modern LLMs have huge context windows, a 3-hour transcript can still be overwhelming. A simple way to handle this is to break the text into 5,000-word chunks. Process each chunk individually and then ask the LLM to provide a “summary of summaries” for the final output.
Going 100% Local with Ollama
If you’re summarizing sensitive internal meetings, you might not want to send data to OpenAI. You can swap the OpenAI call for a local LLM like Llama 3 running through Ollama. It’s free, private, and surprisingly capable.
import requests
def summarize_locally(text):
payload = {
"model": "llama3",
"prompt": f"Summarize this technical transcript: {text}",
"stream": False
}
r = requests.post("http://localhost:11434/api/generate", json=payload)
return r.json()["response"]
Final Tips for Production Use
After processing hundreds of hours of video, I’ve found a few optimizations that make the script much more reliable.
- GPU Acceleration: If you have an NVIDIA card, ensure Whisper is using CUDA. Transcription that takes 10 minutes on a CPU can finish in 45 seconds on a GPU.
- Cleanup: Always use a
try...finallyblock to delete the temporary.m4afiles. If you don’t, your storage will disappear quickly. - Specific Prompting: Don’t just ask for a summary. Tell the AI to “Act as a Senior Engineer” and specifically look for code snippets or library names.
This pipeline transforms how you consume information. Instead of a growing list of “Watch Later” videos, you now have a tool that gives you the core value of a presentation in the time it takes to drink a cup of coffee.

