Skip to main content

transcribe()v4.0.518

Transcribes a 16kHz mono waveform and returns words with start and end timestamps.

transcribe.ts
import {resampleTo16Khz, transcribe} from '@remotion/whisper-webgpu'; const file = new File([], 'audio.wav'); const channelWaveform = await resampleTo16Khz({file}); const result = await transcribe({ channelWaveform, model: 'small.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. This option is required for multilingual models because automatic language detection is not supported. Omit it for English-only models such as small.en.

chunkLengthInSeconds?​

Length of long-audio chunks. Default: 30. Must be a finite number greater than 0.

strideLengthInSeconds?​

Overlap on both sides of a chunk. Default: 5. Must be finite, non-negative, and 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​

BrowsersEnvironments
Chrome
Firefox
Safari

See also​