Transcribing a recording in the wrong language gives you garbled text, or text in the wrong language entirely. faster-whisper can tell you which language it hears before you commit to a full transcription: call transcribe() without naming a language, and it detects the language and hands it back with a probability. This guide is about faster-whisper’s own detection, built on CTranslate2 — a different package and a different call from the openai-whisper detect_language() guide, which uses the Python whisper package.
Load a multilingual model
Install the package — the README gives pip install faster-whisper, and it needs Python 3.9 or greater. Unlike openai-whisper, FFmpeg does not need to be installed on the system: the audio is decoded with the Python library PyAV, which bundles the FFmpeg libraries. Then load a model. The README’s example loads large-v3 on GPU with FP16, and shows the CPU form as well:
from faster_whisper import WhisperModel
model = WhisperModel("base", device="cpu", compute_type="int8")
Use a multilingual model, not an English-only .en one. The source is blunt about it: if the model is not multilingual, the language is set to "en" and the language probability to 1 — no detection happens at all. The model sizes the code lists include tiny, base, small, medium, large-v3, and turbo, each with an English-only .en twin where one exists.
Detect the language before transcribing
Call transcribe() without a language argument. The README’s own example does exactly this and prints what was detected:
segments, info = model.transcribe("audio.mp3", beam_size=5)
print("Detected language '%s' with probability %f" % (info.language, info.language_probability))
Two details matter. First, segments is a generator, and the README warns that the transcription only starts when you iterate over it — so info.language and info.language_probability are available before any transcription has run, which is what makes this a check you do first. Second, the transcribe() documentation says that if the language is not set, it will be detected in the first 30 seconds of audio. Two knobs control the check: language_detection_threshold, which defaults to 0.5 — if the maximum probability of the language tokens is higher than this value, the language is detected — and language_detection_segments, which defaults to 1, the number of segments to consider for the detection. Underneath, transcribe() calls the model’s own detect_language() method, which returns the language, its probability, and the full list of language probabilities.
Pass the detected language back
Once the printed language matches the language you recorded, transcribe with that language named explicitly. The transcribe() documentation says the language should be a language code such as "en" or "fr":
segments, info = model.transcribe("interview.wav", language="ja", beam_size=5)
for segment in segments:
print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
If the probability is at or below the 0.5 threshold, treat the detection as uncertain: listen to the recording yourself and set the language by ear instead of trusting the guess. The full ranking is also available as info.all_language_probs on the same TranscriptionInfo object, so you can see how close the runner-up language was.
Try it: four checks
| Check | What you should see | If you do not see it |
|---|---|---|
| Model | WhisperModel("base", device="cpu", compute_type="int8") loads without an error |
Install with pip install faster-whisper — the README needs Python 3.9 or greater |
| English recording | info.language prints en |
You loaded an English-only .en model, which always reports en — load a multilingual model instead |
| Japanese recording | info.language prints ja |
The recording is mostly silence or noise — re-record it clearly and try again |
| Probability | info.language_probability prints a value above 0.5, the detection threshold |
At or below 0.5 the detector is not confident — listen to the recording and set the language yourself |
Expected result. We checked the faster-whisper README for the pip install command, the Python 3.9 requirement, the PyAV note that FFmpeg is not needed, the WhisperModel load examples on GPU and CPU, the transcribe example with beam_size=5, the detected-language print line, and the warning that segments is a generator so transcription only starts when you iterate; and the transcribe.py source for the TranscriptionInfo fields language, language_probability, and all_language_probs, the first-30-seconds detection note, the language_detection_threshold default of 0.5 and the language_detection_segments default of 1, the English-only model rule that sets language to “en” with probability 1, and the detect_language method returning language, language_probability, and all_language_probs. We did not run faster-whisper or detect any language.
Limits
Detection reads only the first 30 seconds, so it says nothing about a language change later in a long recording. Detection is a probability, not a certainty: short clips, heavy accents, background noise, and mixed-language speech can all lower the probability or flip the answer. An English-only model never detects at all — it reports en with probability 1. And this is faster-whisper’s detection, built on CTranslate2, which is different from the openai-whisper detect_language() guide and from simply passing a language you guessed. We did not run faster-whisper, so no detected language here is a measured result.
Sources
- faster-whisper README — pip install faster-whisper; Python 3.9 or greater; FFmpeg not needed, audio decoded with PyAV; WhisperModel load examples on GPU with FP16 and on CPU with INT8; transcribe example with beam_size=5 and the detected-language print line; segments is a generator so transcription only starts when you iterate
- faster-whisper transcribe.py — TranscriptionInfo with language, language_probability, and all_language_probs; language detected in the first 30 seconds if not set, as a code such as “en” or “fr”; language_detection_threshold default 0.5 and language_detection_segments default 1; English-only models set language to “en” with probability 1; detect_language returns language, language_probability, and all_language_probs
