Summarizing a YouTube video2025-06-04
Someone on a forum asked for a summary of a YouTube video so I figured I'd see how well Ollama/Gemma3 can do it. I used some bash fun to convert the subtitles, as I found existing tools overcomplicated. You'll also need to increase your Ollama context limit from the default 4k to 16k or higher if the video is particularly long.
videoID="[YOUTUBE VIDEO ID]";
yt-dlp --write subs --write-auto-subs --skip-download "https://www.youtube.com/watch?v=$videoID";
cat "*$videoID*.vtt" | grep -v "<>" | grep -v "\-\->" | grep -v "><" | awk '!seen[$0]++' | tail -n +4 | tr '\n' ' ' > "/tmp/transcript-$videoID";
ollama run gemma3:12b-it-qat "Please write a breakdown and summary of the following, ignore any sponsorship segments: $(cat /tmp/transcript-$videoID)" > "summary-$videoID";