← all posts site ↗

a simple python script for local transcription

had the parakeet transcription server running on the home server from a previous setup session but i kept opening a browser tab to use the swagger ui to test it. annoying workflow. so i wrote a thirty-line python script that takes an audio file path, hits the local api, and writes the transcript to a text file with the same name. argparse for the cli, requests for the http call, and a bit of pathlib for the output naming. the script checks the file extension, opens the binary, and posts it to the /v1/audio/transcriptions endpoint. response comes back as json with the transcript text.

first run on a 45-minute meeting recording timed out. the default requests timeout is like 30 seconds and the server takes longer because it's chunking the audio on cpu. bumped it to 300 seconds and everything started working. the server returns the full transcript as one response after it's done processing, so there's no streaming or partial results to deal with. you just wait. long enough audio files make you wonder if it hung but checking the server logs shows it chugging along at about 2x realtime on the hardware i'm running. output piping was trivial — open a file with the same stem and .txt extension, write the response text, done.

the script is probably the most boring code i've written this month but boring is the goal. it does one thing, does it reliably, and i can call it from anywhere — cron job for daily voice notes, obsidian plugin hook, even from a shell alias when i just want to transcribe something fast. the whole thing lives in my path next to a handful of other utility scripts. no dependencies beyond requests and argparse, both stdlib or pip install. next step might be adding a flag for different output formats or speaker diarization if the model supports it, but honestly the flat text file workflow is covering all the actual use cases i have right now.