Skip to content

Instantly share code, notes, and snippets.

@lappi-lynx
Created June 25, 2025 16:54
Show Gist options
  • Save lappi-lynx/7241bdf221b7cf04ed4fe590e7fdb6f0 to your computer and use it in GitHub Desktop.
Save lappi-lynx/7241bdf221b7cf04ed4fe590e7fdb6f0 to your computer and use it in GitHub Desktop.
OpenAI audio transcriptions faster and cheaper
# You’ll need yt-dlp, ffmpeg and llm installed.
# Extract the audio from the video
yt-dlp -f 'bestaudio[ext=m4a]' --extract-audio --audio-format m4a -o 'video-audio.m4a' "https://www.youtube.com/watch?v=LCEmiRjPEtQ" -k;
# Create a low-bitrate MP3 version at 3x speed
ffmpeg -i "video-audio.m4a" -filter:a "atempo=3.0" -ac 1 -b:a 64k video-audio-3x.mp3;
# Send it along to OpenAI for a transcription
curl --request POST \
--url https://api.openai.com/v1/audio/transcriptions \
--header "Authorization: Bearer $OPENAI_API_KEY" \
--header 'Content-Type: multipart/form-data' \
--form [email protected] \
--form model=gpt-4o-transcribe > video-transcript.txt;
# Get a nice little summary
cat video-transcript.txt | llm --system "Summarize the main points of this talk."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment