# Packages
# README
Better-Whisper 🎙️ - Config-free Whisper Transcription
Better-Whisper is a command-line interface tool that uses the Whisper speech recognition model, providing easy audio file conversion and transcription capabilities. It handles all media formats so you can transcribe any file without configuration.
Quick Start
1. Install whisper.cpp
If you're on macOS, that's
brew install whisper-cpp
2. Download a model
I recommend starting with ggm-small.en
as your model: https://huggingface.co/ggerganov/whisper.cpp/tree/main
3. Run the script
You can quickly run the Better-Whisper directly from GitHub using the go run
command:
go run github.com/akash-joshi/[email protected] [whisper-cpp arguments] <input-file>
Or locally with
go run main.go [whisper-cpp arguments] <input-file>
Example
better-whisper -m ~/Documents/ggml-model-whisper-small.en.bin -t 4 -p 2 -ml 21 -sow -osrt
Features
- Converts various audio formats to WAV for Whisper processing
- Executes Whisper transcription on audio files
- Handles both direct Whisper commands and audio file inputs
Pre-requisites
You need to have ffmpeg
and whisper-cpp
installed on your system.
Usage
Instant usage:
go run main.go [whisper-cpp arguments] <input-file>
Build the project:
go build -o better-whisper main.go
Run the CLI tool:
./better-whisper [whisper-cpp arguments] <input-file>
If the input file exists, it will be converted to WAV format (if necessary) before being passed to Whisper. If the input file doesn't exist, the command will be passed directly to Whisper.
How it works
- The tool checks if the provided file exists.
- If the file exists, it's converted to a 16kHz, mono, 16-bit PCM WAV file using FFmpeg.
- The Whisper model is then executed on the converted file.
- After transcription, the temporary WAV file is deleted.
Error Handling
Errors during file conversion or Whisper execution are printed to the console. The tool attempts to clean up temporary files even if errors occur during transcription.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.