
Faster-whisper runs Whisper speech recognition through CTranslate2 and can transcribe audio on a CPU or a supported GPU. For a new transcription job, start by checking whether the output is useful and the whole job finishes within your deadline. The library's name does not tell you which machine your recordings need.
This guide builds a small CPU transcription job that saves text and segment timestamps to JSON. We tested it with an original synthetic English recording, silence, invalid input, and simulated output failures. The example is a starting point for evaluating your own audio, with specific limits on what its results prove.
Faster-whisper is an alternative implementation of Whisper inference, using CTranslate2 rather than the original implementation's execution path. The package exposes a Python API for transcription and supports options such as language selection, beam search, word timestamps, and voice activity detection. Its audio decoding uses PyAV, whose binary wheels bundle FFmpeg libraries; our example did not require a separate FFmpeg command-line installation.
Several jobs often described as “transcription” need different outputs. A searchable recording needs readable text. Subtitles need checked timing and suitable line breaks. A meeting record may also need speaker identities. This example provides text and segment timestamps, without speaker diarization, word-level alignment, subtitle formatting, or live streaming.
Choose a small evaluation set before choosing infrastructure: short and long recordings, the languages you actually use, quiet and noisy speech, and representative names or technical terms. Write down a completion target and the errors a reviewer must catch. A clean synthetic sentence cannot stand in for that collection.
Our local test used Windows 11, Python 3.12.14, faster-whisper 1.2.1, CTranslate2 4.9.0, PyAV 18.1.0, and huggingface-hub 2.4.0. It ran on an AMD Ryzen 7 7840HS with four inference threads and one model worker. No GPU was used. The CTranslate2 installation guide lists supported platforms and the Windows Visual C++ runtime requirement.
Create a new environment. These commands use its Python directly, so shell activation is unnecessary. Run them in a new working folder:
python -m venv .venv
.venv/Scripts/python.exe -m pip install faster-whisper==1.2.1 ctranslate2==4.9.0 av==18.1.0 huggingface-hub==2.4.0
On Linux, use .venv/bin/python in place of .venv/Scripts/python.exe in the commands below. The recorded validation is from the Windows CPU environment, not a separate Linux or cloud deployment test.
The PyAV pin matters for this version set. Our initial installation selected PyAV 19.0.2, and transcription failed with open() got an unexpected keyword argument 'metadata_errors'. PyAV 19 removed that argument, which faster-whisper 1.2.1 still passes when decoding a file. Pinning 18.1.0 resolved the tested failure. Revalidate the combination when upgrading; these pins describe a working example, not a permanent version policy.
We use Systran's CTranslate2 conversion of Whisper tiny.en. It is an English-only model, selected to keep this first test small. For French or another language, choose a multilingual model and validate that language separately. Changing language="en" alone does not turn an English-only model into a multilingual one.
Save this as get_model.py. It downloads the model files from a fixed commit rather than a moving default branch. Hugging Face documents revision-specific downloads. The public model download needs internet access but no account token in this example.
import os
from pathlib import Path
root = Path(__file__).resolve().parent
os.environ.setdefault("HF_HOME", str(root / ".hf-cache"))
os.environ["HF_HUB_DISABLE_IMPLICIT_TOKEN"] = "1"
from huggingface_hub import snapshot_download
snapshot_download(
"Systran/faster-whisper-tiny.en",
revision="0d3d19a32d3338f10357c0889762bd8d64bbdeba",
local_dir=root / "model",
allow_patterns=["config.json", "model.bin", "tokenizer.json", "vocabulary.txt"],
token=False,
)
Run the download once:
.venv/Scripts/python.exe get_model.py
The transcription script loads the resulting local directory. Keep its revision and the package versions with your results. CPU int8 is the requested compute type, not a promise that every operation uses eight-bit arithmetic; CTranslate2 describes the supported types and conversions.
Save the following as transcribe.py. Put a short English recording you are allowed to process in the same folder as sample.wav. The output folder must already exist. Use a different output path for every job, and do not point the output at the recording or another file you need to keep.
import json
import os
import sys
import tempfile
from pathlib import Path
from time import perf_counter
from faster_whisper import WhisperModel
def transcribe_file(model, audio, output):
start = perf_counter()
segments, info = model.transcribe(
str(audio), language="en", task="transcribe",
beam_size=5, temperature=0, vad_filter=True,
condition_on_previous_text=False,
)
# Iterating runs the transcription; do not stop the timer earlier.
rows = [
{"start": s.start, "end": s.end, "text": s.text.strip()}
for s in segments
]
result = {
"language": info.language,
"audio_seconds": info.duration,
"transcription_seconds": perf_counter() - start,
"text": " ".join(row["text"] for row in rows),
"segments": rows,
"timestamp_warnings": [
i for i, row in enumerate(rows)
if row["start"] < 0 or row["end"] > info.duration
],
}
output = Path(output)
temp = None
try:
with tempfile.NamedTemporaryFile(
mode="w", encoding="utf-8", dir=output.parent,
prefix=output.name + ".", suffix=".tmp", delete=False,
) as f:
temp = Path(f.name)
json.dump(result, f, ensure_ascii=False, indent=2)
f.flush()
os.fsync(f.fileno())
os.replace(temp, output)
finally:
if temp is not None:
temp.unlink(missing_ok=True)
return result
if __name__ == "__main__":
model_dir, audio, output = sys.argv[1:]
model = WhisperModel(
model_dir, device="cpu", compute_type="int8",
cpu_threads=4, num_workers=1, local_files_only=True,
)
result = transcribe_file(model, audio, output)
print(result["text"])
.venv/Scripts/python.exe transcribe.py model sample.wav transcript.json
The key timing detail is the iteration over segments. Returning that generator does not mean transcription has finished. The script consumes it before stopping the transcription timer and writing the result. This timer includes audio decoding and voice activity detection, but excludes model loading and writing the JSON file.
The file contains combined text, estimated start and end times in seconds, and zero-based indices of segments whose timestamps fall outside the audio duration. It writes a temporary file in the destination folder, then replaces the named output after serialization succeeds. A previous result remains intact if decoding or segment generation fails first.
This is a single-job example. It holds the segments in memory and does not coordinate concurrent writers. Use unique job IDs and a separate completion record in a larger service. A forced process termination may leave a temporary file to clean up; the example does not establish power-loss recovery or transactional storage across machines.
We generated a 14.59-second, mono, 16 kHz WAV locally with the Microsoft Zira Desktop synthetic voice and an original 37-word reference. The script recovered all reference words after lowercasing and removing punctuation. That observation covers this one clean synthetic clip, not natural speech recognition accuracy.
| Check | Observed result |
|---|---|
| Speech recording | Four text segments; all 37 reference words matched after normalization |
| Segment timing | Last segment ended at 15.00 seconds, 0.41 seconds beyond the recording; the script flagged it |
| Five seconds of silence, VAD enabled | No text or segments |
| Corrupt or missing input | An error, with no new completed result; an existing result stayed unchanged |
| Injected interruption after one segment | The previous completed result stayed unchanged |
| Injected destination replacement failure | The previous result stayed unchanged and the temporary file was removed |
In the recorded run, model loading took about 0.25 seconds and transcription about 0.94 seconds. Loading through saving the completed output took about 1.19 seconds. Peak process working set was about 229 MiB, covering imports, model loading, and the first transcription. The timers excluded package imports and model downloading; the model files were already local. These are observations from one run on the named machine, not a throughput comparison or a cloud sizing result.
Listen to representative passages and check names, numbers, negations, omissions, and repetitions. The Whisper model card describes limitations including hallucinated text and uneven performance across languages and speakers. Voice activity detection helps select speech regions, but passing our silence check does not guarantee that every silent or noisy file will stay empty. Estimated timestamps also need review before becoming captions.
Measure your own recordings with the same model, language, decoding settings, and quality review before comparing hardware. Record input audio duration, time from job start to saved output, peak memory, failures, and time spent correcting the transcript. Keep model download, first load, and repeated inference measurements separate.
For offline work, divide processing time by audio duration to calculate a real-time factor. A value below one means that measured run processed audio faster than playback. It does not prove that a queue of long recordings will meet its deadline. Include transfer time, worker startup, retries, and competing jobs when estimating a batch.
Keep the CPU path if it meets the quality and completion requirements at an acceptable cost. Test a GPU when the workload needs a larger model, more concurrent jobs, or a shorter completion window. Our CPU, GPU, and NPU comparison explains the broader hardware roles. This article has no GPU benchmark or verified CUDA installation recipe; GPU runtime compatibility needs checking for the exact faster-whisper, CTranslate2, driver, and library versions you choose.
Once a representative test tells you the memory, runtime, and completion target, evaluate Compute with Hivenet for the CPU worker or a separate GPU trial. Check the instance's available resources and current price, then repeat the same job on that instance. Our local laptop result does not establish performance on a Hivenet VM.
You operate the transcription software, models, updates, job handling, and access controls. This workflow uses rented compute; it does not depend on Hivenet Router or a managed Hivenet speech-to-text endpoint.
Hivenet Object Storage can be evaluated for storing source audio and completed transcripts. Download inputs to the worker's local storage, complete the job, and upload the finished result. Define retention and access separately for recordings and text. Running a model locally changes where inference happens; it does not by itself establish privacy, lawful processing, or regulatory compliance.
Start with a representative recording and a completion target. Keep the setup only if the transcript is usable, failures are visible, and the full job fits the budget. Then increase the workload and measure again.
Pick one AI, compute, or storage workload and see the difference for yourself. Spin it up in minutes, or let our team map your fastest path to production.