Go-Whisper is a command-line tool for transcribing video files using OpenAI's Whisper API. It extracts audio from videos, transcribes it using OpenAI's speech-to-text model, and can optionally embed the transcription as subtitles back into the video.
- Extract audio from video files
- Transcribe audio using OpenAI's Whisper model
- Generate SRT subtitle files
- Embed subtitles into the original video (optional)
- Support for multiple languages
- Go 1.24+
- FFmpeg (for audio extraction and subtitle embedding)
- OpenAI API key
git clone https://github.com/cartman720/go-whisper.git
cd go-whisper
go mod download
go build -o go-whisper
You can compile the application for different platforms:
For Windows:
GOOS=windows GOARCH=amd64 go build -o go-whisper.exe
For macOS:
GOOS=darwin GOARCH=amd64 go build -o go-whisper
For Linux:
GOOS=linux GOARCH=amd64 go build -o go-whisper
Create a .env
file in the project root with your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key
./go-whisper --video /path/to/your/video.mp4
You can also run the application directly without compiling:
go run main.go --video /path/to/your/video.mp4
Or with additional parameters:
go run main.go --video /path/to/your/video.mp4 --output /path/to/output/dir --language fr
./go-whisper --video /path/to/your/video.mp4
This will:
- Extract audio from the video
- Transcribe the audio using OpenAI's Whisper model
- Save the transcription as an SRT file in the current directory
- Create a new video with embedded subtitles
./go-whisper --video /path/to/your/video.mp4 --output /path/to/output/dir --language en
--video
,-v
: Path to the video file (required)--output
,-o
: Directory where output files will be saved (default: current directory)--language
,-l
: Language code for transcription (default: "en" for English)
Go-Whisper can also be used for translation. By setting the --language
parameter to a different language than the original video's spoken language, the tool will transcribe and translate simultaneously. This is useful for creating subtitles in a language different from the audio.
For example, if you have a video in English but want Spanish subtitles:
./go-whisper --video ~/Videos/english_lecture.mp4 --language es
This will transcribe the English audio and produce Spanish subtitles embedded in the video.
The tool generates several files in the specified output directory:
audio-[timestamp].wav
: Extracted audio from the videotranscription-[timestamp].txt
: Transcription in SRT formattranscribed-[timestamp].mp4
: Video with embedded subtitles
Go-Whisper supports all languages that OpenAI's Whisper model can transcribe. Some common language codes:
en
: Englishes
: Spanishfr
: Frenchde
: Germanit
: Italianja
: Japaneseko
: Koreanzh
: Chinese
# Transcribe a video in English
./go-whisper --video ~/Videos/lecture.mp4 --output ~/Documents/Transcriptions
# Transcribe a video in Spanish
./go-whisper --video ~/Videos/spanish_interview.mp4 --language es
To contribute to this project:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI Whisper for the speech recognition model
- Cobra for the CLI framework
- FFmpeg for media processing
Aren Hovsepyan Β© All Rights Reserved