transcribe()v4.0.518
Transcribes a 16kHz mono waveform and returns words with start and end timestamps.
transcribe.tsimport {resampleTo16Khz ,transcribe } from '@remotion/whisper-webgpu'; constfile = newFile ([], 'audio.wav'); constchannelWaveform = awaitresampleTo16Khz ({file }); constresult = awaittranscribe ({channelWaveform ,model : 'small.en',language : 'en', });console .log (result .text ,result .words );
Options
channelWaveform
A mono Float32Array sampled at 16kHz. Use resampleTo16Khz() for browser audio files.
model
One of the timestamped models returned by getAvailableModels(). small or small.en is the recommended default.
language?
The spoken language name or language code. Default: 'auto'. Set it when known to reduce language-detection errors.
chunkLengthInSeconds?
Length of long-audio chunks. Default: 30.
strideLengthInSeconds?
Overlap on both sides of a chunk. Default: 5. It must be less than half of chunkLengthInSeconds.
onModelLoadProgress?
Called while the model is loaded. To load independently, use loadWhisperModel().
Return value
Returns the full text, timestamped words, and selected model.
Word-level timestamps are returned after transcription completes. Transformers.js does not currently stream word-aligned updates while inference is running.
Compatibility
| Browsers | Environments | |||||
|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | ||||