This script provides a quick way to convert audio files into WAV format and extract transcriptions using whisper-cli. It supports automatic detection of an audio file in the script's directory and saves the transcription as a .md file.
- Automatically finds an audio file in the script directory
- Converts audio to WAV (16-bit, mono, 16kHz) using
ffmpeg - Transcribes the audio using
whisper-cli - Saves the transcription as a text file
- Displays execution times with colored terminal output
You can install whisper-cli either by compiling it manually or using Homebrew:
brew install whisper-cppFollow the instructions in the official whisper.cpp repository:
Whisper.cpp GitHub
Whisper models are required for transcription. Download a model from: Whisper.cpp Models
Once downloaded, set the MODEL_PATH variable in the script to point to the model file.
This script requires colorama and ffmpeg.
pip install coloramabrew install ffmpeg # macOS
sudo apt install ffmpeg # Debian/Ubuntu
choco install ffmpeg # Windows (Chocolatey)Edit the script to specify your paths:
WHISPER_PATH = '/opt/homebrew/bin/whisper-cli' # Path to whisper-cli
MODEL_PATH = '/opt/homebrew/Cellar/whisper-cpp/1.7.4/ggml-large-v3-turbo.bin' # Path to downloaded modelModify these paths if you compiled whisper-cli yourself.
- Place an audio file (e.g.,
.mp3,.wav,.m4a, etc.) in the same directory as the script. - Run the script:
python transcript.py
- The transcript will be saved as
transcription.mdin the same directory.