Can whisper.cpp translate to other languages besides English?
You can´t use whisper.cpp to translate directly into languages other than English but you can use a two-step workflow to translate audio into a non-English language.
- whisper.cpp
- translation
No, whisper.cpp cannot translate directly into languages other than English. The underlying OpenAI Whisper model is hardcoded and trained exclusively to handle two primary tasks: transcribing any supported language into its own native text, or translating any supported language directly into English.
If you try to use the -tr (translate) flag, it will automatically default to an English output.
To translate audio into a non-English language (for example, translating Spanish audio into Chinese subtitles), you must use a two-step workflow.
The Two-Step Translation Solution
Step 1: Transcribe the Audio to Text
First, use whisper.cpp to output a subtitle file (.srt or .vtt) in the audio's original native language.
./main -m models/ggml-medium.bin -f spanish_audio.wav -l es -osrtThis outputs spanish_audio.wav.srt in Spanish.
Step 2: Pass the Subtitles to a Translation Model
Because whisper.cpp cannot do X-to-Y language translation, you need to route the resulting subtitle text through a dedicated language model. You have two highly effective options to automate this:
- Option A: Local Translation (Free & Private)
Use an open-source LLM engine like [Ollama] running a model likeLlama 3orMistral. You can run a quick script to feed the SRT file to the local model with the prompt: "Translate this SRT file into Chinese while strictly preserving the subtitle timestamps." - Option B: DeepL / Google Translate API
If privacy isn't a strict constraint, you can pass the subtitle file through the [DeepL API] or a command-line tool liketranslate-shell. These tools are explicitly designed to translate text while keeping the.srtformatting and timestamps completely intact.