Skip to main content

@remotion/whisper-webgpuv4.0.518

Transcribe audio locally in the browser using timestamped Whisper models and WebGPU through Transformers.js, and convert the result to @remotion/captions.

Installation​

npx remotion add @remotion/whisper-webgpu @huggingface/transformers

Example​

transcribe.ts
import {clearStaleModels, resampleTo16Khz, toCaptions, transcribe} from '@remotion/whisper-webgpu'; await clearStaleModels(); const file = new File([], 'audio.wav'); const channelWaveform = await resampleTo16Khz({file}); const transcription = await transcribe({ channelWaveform, model: 'small.en', language: 'en', }); const {captions} = toCaptions({whisperWebGpuOutput: transcription}); console.log(captions);

The model is downloaded on the first call and cached by the browser. Call loadWhisperModel() first to display model download progress.

Model hosting​

We noticed that hosting the models on R2 leads to faster downloading than through Hugging Face. Therefore, we mirrored the models to remotion.media, keeping them byte-identical.

APIs​

Requirements​

WebGPU requires HTTPS in production or localhost during development. Use canUseWhisperWebGpu() to check for a usable adapter.

License​

MIT