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', });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.
task?v4.0.523
Either transcribe or translate. Default: transcribe.
translate translates speech into English and is supported by multilingual non-turbo models only. Check the model's supportsTranslation property before using it. Word timestamps may be less reliable when translating.
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.
forceFullSequences?v4.0.523
Whether every sequence must end with a timestamp. Default: false. Must be a boolean. When set to true, transcription throws if the model returns a trailing sequence without an ending timestamp.
doSample?v4.0.523
Whether to sample tokens probabilistically instead of always choosing the most likely token. Default: false. Must be a boolean. Sampling can produce different results between runs.
temperature?v4.0.523
Controls randomness when doSample is true. Default: 1. Must be a finite number greater than 0; lower values favor more likely tokens.
topK?v4.0.523
Limits sampling to the tokens with the highest probabilities when doSample is true. Default: 50. Must be a non-negative integer; 0 disables the limit.
repetitionPenalty?v4.0.523
Adjusts the probability of tokens that have already been generated. Default: 1, which applies no penalty. Must be a finite number greater than 0; values above 1 discourage repetition and values below 1 encourage it.
noRepeatNgramSize?v4.0.523
Prevents a generated token sequence of this length from occurring more than once. Default: 0, which disables the constraint. Must be a non-negative integer.
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 | ||||