m-bain/whisperX: Fast ASR with Word-Level Timestamps & Diarization
m-bain/whisperX: Fast ASR with Word-Level Timestamps & Diarization
Developers building audio pipelines face a persistent problem: OpenAI's Whisper produces accurate transcriptions, but its timestamps are utterance-level and can drift by several seconds. For applications needing precise synchronization—subtitles, meeting transcripts, or speaker-attributed dialogue—this inaccuracy breaks downstream workflows. Worse, Whisper lacks native batching, making large-scale inference painfully slow.
m-bain/whisperX solves both problems. Built on top of Whisper and maintained by Max Bain with support from Oxford's Visual Geometry Group, this open-source Python↗ Bright Coding Blog toolkit adds forced phoneme alignment for word-level timestamps, voice activity detection (VAD) for hallucination reduction, and optional speaker diarization via pyannote-audio. With 23,085 GitHub stars and a BSD 2-Clause license, it has become a pragmatic choice for production speech pipelines.
What is m-bain/whisperX?
m-bain/whisperX is a Python-based automatic speech recognition (ASR) toolkit that enhances OpenAI's Whisper with three critical capabilities missing from the base model: accurate word-level timestamps, batched inference for 70x realtime speed, and multispeaker diarization.
The project emerged from research at the University of Oxford's Visual Geometry Group (VGG), published at INTERSPEECH 2023 and winner of 1st place in the Ego4d transcription challenge. Version 3, the current release, achieves its speedup through a faster-whisper backend with batched inference—requiring under 8GB GPU memory for large-v2 with beam_size=5.
Unlike Whisper's default behavior, which transcribes audio in buffered segments with timestamp approximation, WhisperX uses forced alignment: it takes Whisper's orthographic output and aligns it to phoneme-level audio features using wav2vec2.0 models. This yields sub-second timestamp accuracy without degrading word error rate (WER).
The toolkit also integrates voice activity detection (silero-vad or pyannote's VAD) to strip non-speech segments before inference, reducing both hallucination and compute waste. For multispeaker content, pyannote-audio's diarization pipeline assigns speaker IDs to each word—a feature critical for meeting transcription, podcast analysis, and legal deposition processing.
With its last commit dated July 13, 2026, the project shows active maintenance, though the README notes it has "diverged from the original research scope" and relies on community contributions for continued development.
Key Features
⚡ Batched Inference at 70x Realtime
WhisperX's headline performance claim is 70x realtime transcription using whisper large-v2. This comes from batching multiple audio segments through a faster-whisper backend powered by CTranslate2, rather than Whisper's single-sample processing. The README explicitly notes this required --without_timestamps True during inference to enable single forward passes per batch.
🎯 Forced Phoneme Alignment The core differentiator. WhisperX uses wav2vec2.0 models (automatically selected by language code) to force-align Whisper's text output to audio phonemes. This produces word-level timestamps accurate enough for subtitle synchronization—something Whisper's built-in timestamps cannot reliably achieve.
👯 Speaker Diarization Via pyannote-audio's speaker-diarization-community-1 model, WhisperX can partition audio by speaker identity and label each transcribed word with a speaker ID. This requires a Hugging Face access token and acceptance of the model's user agreement.
🗣️ VAD Preprocessing Voice activity detection filters non-speech before transcription, which the paper shows reduces WER while enabling accurate batching. VAD filtering is on by default as of v2.
🪶 Memory Efficiency The faster-whisper backend runs large-v2 with beam_size=5 on under 8GB GPU memory. For resource-constrained environments, users can reduce batch size, use smaller models (base), or switch to int8 compute type.
🌍 Multilingual Support Automatic alignment model selection for tested languages {en, fr, de, es, it} via torchaudio pipelines, plus extended Hugging Face model support for additional languages. Users must supply their own wav2vec2 phoneme model for untested languages.
Use Cases
Meeting Transcription with Speaker Attribution The most natural fit for WhisperX's full feature set. Recorded meetings require both accurate text and who said what. The diarization pipeline assigns speaker IDs per word, while sentence-level segmentation (via NLTK sent_tokenize, added in v3) produces readable paragraph breaks. The README's sponsor section explicitly positions this against APIs like Recall.ai for Zoom, Teams, and Meet transcription.
Video Subtitle Generation
Word-level timestamps enable frame-accurate subtitle placement. The --highlight_words True flag visualizes word timings in SRT output, and v3's sentence-level segments improve readability over raw word lists. The comparison video in the README demonstrates WhisperX's synchronization against Whisper's visibly drifted output.
Podcast and Interview Analysis Long-form audio with multiple speakers benefits from both speed and diarization. At 70x realtime, a one-hour podcast transcribes in under a minute. Speaker labels enable downstream analytics: who dominates conversation, turn-taking patterns, or quote extraction by speaker.
Low-Resource Language Documentation For languages lacking commercial ASR support, WhisperX's extensible alignment pipeline allows researchers to integrate custom wav2vec2 phoneme models from Hugging Face. The README explicitly solicits community contributions for testing new language models.
Real-Time Monitoring (with caveats) While 70x realtime suggests near-real-time capability, the README does not explicitly position WhisperX for streaming use. The batching architecture implies latency from segment accumulation, making it better suited for post-hoc transcription than live captioning.
Installation & Setup
WhisperX requires Python and optionally CUDA 12.8 for GPU acceleration.
CUDA Prerequisites (GPU users)
Install CUDA toolkit 12.8 before WhisperX:
- Linux: Follow NVIDIA's CUDA Installation Guide for Linux
- Windows: Download from NVIDIA CUDA 12.8 Archive
Skip this step for CPU-only usage.
Standard Installation
pip install whisperx
Or using uvx:
uvx whisperx
Development Installation
For contributors or those needing unreleased features:
git clone https://github.com/m-bain/whisperX.git
cd whisperX
uv sync --all-extras --dev
Note: The development version may contain experimental features and bugs. Use the stable PyPI release for production environments.
Speaker Diarization Setup
Diarization requires additional configuration:
- Generate a Hugging Face read token at huggingface.co/settings/tokens
- Accept the user agreement for pyannote/speaker-diarization-community-1
- Pass your token via
--hf_tokenor the Python API
You may also need ffmpeg and Rust. Follow OpenAI's Whisper setup instructions for these dependencies.
Real Code Examples
Command-Line Transcription (English)
Basic usage with default parameters (whisper small):
whisperx path/to/audio.wav
For improved accuracy with larger models and explicit alignment model:
whisperx path/to/audio.wav --model large-v2 --align_model WAV2VEC2_ASR_LARGE_LV60K_960H --batch_size 4
With speaker diarization and word highlighting:
whisperx path/to/audio.wav --model large-v2 --diarize --highlight_words True --min_speakers 2 --max_speakers 2
CPU/Macos execution with reduced precision:
whisperx path/to/audio.wav --compute_type int8 --device cpu
German Language Transcription
whisperx --model large-v2 --language de path/to/audio.wav
The --language flag triggers automatic alignment model selection from torchaudio or Hugging Face pipelines.
Python API: Full Pipeline
import whisperx
import gc
from whisperx.diarize import DiarizationPipeline
device = "cuda"
audio_file = "audio.mp3"
batch_size = 16 # reduce if low on GPU mem
compute_type = "float16" # change to "int8" if low on GPU mem (may reduce accuracy)
# 1. Transcribe with original whisper (batched)
model = whisperx.load_model("large-v2", device, compute_type=compute_type)
audio = whisperx.load_audio(audio_file)
result = model.transcribe(audio, batch_size=batch_size)
print(result["segments"]) # before alignment
# 2. Align whisper output
model_a, metadata = whisperx.load_align_model(
language_code=result["language"],
device=device
)
result = whisperx.align(
result["segments"],
model_a,
metadata,
audio,
device,
return_char_alignments=False
)
print(result["segments"]) # after alignment
# 3. Assign speaker labels
diarize_model = DiarizationPipeline(token=YOUR_HF_TOKEN, device=device)
diarize_segments = diarize_model(audio)
# diarize_model(audio, min_speakers=min_speakers, max_speakers=max_speakers)
result = whisperx.assign_word_speakers(diarize_segments, result)
print(diarize_segments)
print(result["segments"]) # segments are now assigned speaker IDs
This three-stage pipeline—transcribe, align, diarize—reflects WhisperX's modular architecture. Each stage can run independently, and models can be deleted between stages to free GPU memory for resource-constrained environments.
Advanced Usage & Best Practices
Memory Management The README suggests explicit model deletion between pipeline stages when GPU memory is tight:
import gc
import torch
gc.collect()
torch.cuda.empty_cache()
del model # or model_a
Quality vs. Speed Trade-offs
For highest timestamp accuracy, use larger Whisper models (large-v2, large-v3) with --batch_size 4 or lower. The README notes that larger alignment models "were not found to be that helpful"—invest compute in the ASR model, not the aligner.
WER Reduction
WhisperX diverges from default Whisper in three ways that affect output: (1) --without_timestamps True enables batching but may cause discrepancies; (2) VAD-based segmentation replaces buffered transcription; (3) --condition_on_prev_text defaults to False to reduce hallucination. These are design choices, not bugs—evaluate on your data.
Language-Specific Alignment If WhisperX lacks a default aligner for your language, find a phoneme-based wav2vec2 model on Hugging Face and test before production deployment. The project explicitly welcomes pull requests for validated new language support.
Compute Type Selection
Use float16 for best accuracy on modern GPUs. Fall back to int8 only when memory-constrained or on CPU—expect potential accuracy degradation.
Comparison with Alternatives
| Feature | m-bain/whisperX | OpenAI Whisper | faster-whisper |
|---|---|---|---|
| Word-level timestamps | ✅ Forced alignment | ❌ Utterance-level only | ❌ Same as Whisper |
| Batched inference | ✅ 70x realtime | ❌ No native batching | ✅ Via CTranslate2 |
| Speaker diarization | ✅ Integrated | ❌ Not supported | ❌ Not supported |
| GPU memory (large-v2) | <8GB | Higher | Similar |
| License | BSD 2-Clause | MIT | MIT |
OpenAI Whisper remains the reference implementation and simplest starting point. Use it when timestamp precision and speaker separation are unnecessary.
faster-whisper (by Guillaume Klein) provides the backend that enables WhisperX's speed. Use it directly when you need fast Whisper inference without alignment or diarization layers.
WhisperX adds value only when you need its specific enhancements: precise timestamps, speaker labels, or both. The trade-off is increased complexity—three pipeline stages, additional model dependencies, and Hugging Face token management for diarization.
For teams prioritizing minimal maintenance, commercial APIs like [INTERNAL_LINK: speech-to-text API comparison] may justify their cost against self-hosted WhisperX's operational overhead.
FAQ
Does WhisperX require a GPU?
No—use --compute_type int8 --device cpu for CPU execution, including Mac OS X. Expect slower performance.
Why are some words missing timestamps? Words containing characters outside the alignment model's dictionary (e.g., "2014.", "£13.60") cannot be aligned and receive no timing.
How accurate is diarization? The README explicitly states "diarization is far from perfect." It also struggles with overlapping speech, a known limitation shared with base Whisper.
Can I use WhisperX commercially? Yes—BSD 2-Clause license permits commercial use. Note that pyannote's diarization model uses a separate CC-BY-4.0 license.
What languages are supported for alignment?
Tested defaults exist for {en, fr, de, es, it}. Extended languages via Hugging Face. Check DEFAULT_ALIGN_MODELS_HF in alignment.py.
Why does output differ from OpenAI's Whisper?
WhisperX disables timestamp conditioning, uses VAD-based segments, and sets condition_on_prev_text=False by default—all documented design choices for batching and hallucination reduction.
Conclusion
m-bain/whisperX fills a specific, well-defined gap in the open-source ASR ecosystem: production-ready transcription with precise word-level timing and optional speaker attribution. Its 70x realtime speed and modest GPU requirements make it deployable for most teams already running inference workloads.
The tool is best suited for developers building subtitle pipelines, meeting transcription systems, or podcast analytics platforms—anywhere Whisper's utterance-level timestamps prove insufficient. It is less ideal for simple transcription tasks where Whisper alone suffices, or for real-time streaming applications where batching latency matters.
With active maintenance through mid-2026, established academic credibility, and a clear contribution path for multilingual expansion, WhisperX represents pragmatic open-source engineering rather than researchware. Explore the repository, test on your audio, and consider contributing alignment models for underrepresented languages.
Explore on the BrightCoding network
Hand-picked resources from our other sites.
Stop Waiting for Diffusion! BitDance Makes Images 30x Faster
BitDance is a 14B open-source autoregressive image model using binary tokens for 30x faster generation. Learn installation, code examples, benchmarks, and why i...
0xchamin/mcptube: YouTube Knowledge Engine with Vision + Wiki
mcptube transforms YouTube videos into a persistent, compounding knowledge base using transcripts, vision analysis, and a wiki engine. Built as an MCP server fo...
evroon/bracket: Self-Hosted Tournament System for Developers
evroon/bracket is a 1,700-star AGPL-3.0 self-hosted tournament system built with FastAPI and Vite. Supports elimination, round-robin, and Swiss formats with mul...
Continuez votre lecture
Why Alexandrie is the Ultimate Markdown Note-Taking App
Why CrossPaste is the Ultimate Game Changer for Clipboard Management
Why Chandra is the Ultimate OCR Tool for Handwriting and Tables
Stop Coding Alone: OPC-Skills Gives Your AI Agent Superpowers
Commentaires 0
Aucun commentaire pour l'instant. Soyez le premier à réagir !