Skip to content

Instantly share code, notes, and snippets.

@brokosz
Last active January 15, 2026 05:51
Show Gist options
  • Select an option

  • Save brokosz/38d24d6df1a44fffb5c42a00ef1a57ec to your computer and use it in GitHub Desktop.

Select an option

Save brokosz/38d24d6df1a44fffb5c42a00ef1a57ec to your computer and use it in GitHub Desktop.
Smart wrapper for parakeet-mlx audio transcription with sensible defaults - txt to stdout by default, SRT files next to source, easy redirection and dual output options.
#!/bin/zsh
if [[ "$1" == "--help" || "$1" == "-h" || $# -eq 0 ]]; then
echo "Usage: parakeet [options] <audio_file>"
echo "Format:"
echo " -t, --txt: plain text file (default)"
echo " -s, --srt: subtitle file next to input file"
echo " -f, --file: force txt output next to source file"
echo " -c, --copy-txt: also create txt file when using -s"
echo "Output:"
echo " -o, --output-dir <dir>: override output directory"
echo "Processing:"
echo " -v, --verbose: show processing details"
echo " -b, --beam: use beam search (slower but more accurate)"
echo " --no-chunk: disable chunking for short files"
exit 0
fi
format="txt"
force_file=""
copy_txt=""
verbose=""
decoding="greedy"
chunk_duration="120"
custom_output_dir=""
while [[ $# -gt 0 ]]; do
case $1 in
-t|--txt) shift ;;
-s|--srt) format="srt"; force_file="1"; shift ;;
-f|--file) force_file="1"; shift ;;
-c|--copy-txt) copy_txt="1"; shift ;;
-o|--output-dir) custom_output_dir="$2"; shift 2 ;;
-v|--verbose) verbose="--verbose"; shift ;;
-b|--beam) decoding="beam"; shift ;;
--no-chunk) chunk_duration="0"; shift ;;
*) break ;;
esac
done
if [[ -z "$force_file" && -z "$custom_output_dir" ]]; then
parakeet-mlx "$1" --output-format "$format" --decoding "$decoding" --chunk-duration "$chunk_duration" $verbose
else
output_dir="${custom_output_dir:-$(dirname "$1")}"
parakeet-mlx "$1" --output-dir "$output_dir" --output-format "$format" --decoding "$decoding" --chunk-duration "$chunk_duration" $verbose
if [[ "$copy_txt" == "1" && "$format" == "srt" ]]; then
parakeet-mlx "$1" --output-format "txt" --decoding "$decoding" --chunk-duration "$chunk_duration" $verbose
fi
fi
@brokosz
Copy link
Author

brokosz commented Jan 15, 2026

Parakeet Transcription Wrapper

Smart wrapper around parakeet-mlx with sensible defaults for common transcription workflows.

Features

  • Smart file placement - txt in current dir, SRT next to source by default
  • Dual output mode - SRT file + text copy to stdout simultaneously
  • Beam search option - better accuracy when needed
  • Directory overrides - when you need files elsewhere

Installation

pip install parakeet-mlx
# Save script to ~/bin/parakeet
chmod +x ~/bin/parakeet

Usage Examples

# Text transcription
parakeet audio.wav                    # creates audio.txt in current directory
parakeet -f audio.wav                 # creates audio.txt next to source file
parakeet -f -o ~/Downloads audio.wav  # creates audio.txt in ~/Downloads

# Subtitle files  
parakeet -s video.mp4                 # creates video.srt next to source
parakeet -s -o ~/Desktop video.mp4    # creates video.srt in ~/Desktop

# Dual output (SRT + text to stdout)
parakeet -s -c audio.wav              # creates audio.srt + audio.txt (both next to source)

# Better accuracy
parakeet -b audio.wav                 # use beam search
parakeet -v audio.wav                 # verbose processing info

Works with any audio/video format that parakeet-mlx supports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment