A command-line tool that transcribes audio files to text using OpenAI's Whisper model. It supports local files and URLs, shows progress during transcription, and can handle various audio formats.
- Transcribe audio files from local paths or URLs
- Support for multiple audio formats: MP3, WAV, M4A, OGG
- Progress indication during transcription
- Automatic clipboard copying of transcription
- Optional saving to a text file
- Memory-efficient chunked processing for large files
- Python 3.7 or higher
- ffmpeg (required by pydub for audio processing)
-
Ubuntu/Debian:
sudo apt update sudo apt install ffmpeg
-
macOS:
brew install ffmpeg
-
Windows: Download from ffmpeg.org and add to system PATH
-
Clone the repository:
git clone [your-repo-url] cd audio-transcriber
-
Create and activate a virtual environment (recommended):
-
Linux/macOS:
python -m venv venv source venv/bin/activate
-
Windows:
python -m venv venv venv\Scripts\activate
-
-
Install required Python packages:
pip install -r requirements.txt
-
Make the script executable and create a system-wide command:
-
Linux/macOS:
chmod +x transcribe.py sudo ln -s "$(pwd)/transcribe.py" /usr/local/bin/transcribe
-
Windows:
- Add the script directory to your system PATH
- Create a batch file named
transcribe.bat
in the same directory:@echo off python "%~dp0transcribe.py" %*
-
-
Basic usage:
transcribe path/to/audio.mp3
-
With output file:
transcribe path/to/audio.mp3 -o /output/directory
-
From URL:
transcribe https://example.com/audio.mp3
audio_source
: Path or URL to the audio file (required)-o, --output
: Directory to save the transcription file (optional)
- MP3 (.mp3)
- WAV (.wav)
- M4A (.m4a)
- OGG (.ogg)
- Validates the input (local file or URL)
- Downloads the audio file if it's a URL
- Loads the Whisper model (tiny.en)
- Splits the audio into 30-second chunks for efficient processing
- Transcribes each chunk with progress indication
- Combines the transcriptions
- Copies the result to the clipboard and optionally saves it to a file
- Cleans up temporary files and frees memory
The tool relies on the following Python packages:
- openai-whisper: Core transcription functionality (includes torch as a dependency)
- tqdm: Progress bar display
- requests: URL handling and downloads
- pyperclip: Clipboard operations
- pydub: Audio file processing and chunking
- ffmpeg: Required by pydub for audio processing
-
ffmpeg not found:
- Ensure ffmpeg is installed and in your system PATH
- Try running
ffmpeg -version
to verify installation
-
Clipboard access error:
- On Linux, install xclip:
sudo apt-get install xclip
- On Windows, ensure you have access to the clipboard
- On Linux, install xclip:
-
Memory issues with large files:
- The tool automatically processes audio in chunks
- If still experiencing issues, try closing other applications
- "File does not exist": Check the file path and permissions
- "Not a supported audio format": Convert your audio to a supported format
- "Could not copy to clipboard": Check clipboard access permissions