---
image: https://remotion.media/docs/generated/articles-docs-whisper-webgpu-index.png
title: '@remotion/whisper-webgpu'
crumb: 'Transcribe audio locally'
---

# @remotion/whisper-webgpu<AvailableFrom v="4.0.518" />

Transcribe audio locally in the browser or Node.js using timestamped Whisper models and WebGPU through [Transformers.js](https://huggingface.co/docs/transformers.js), and convert the result to [`@remotion/captions`](/docs/captions).

## Installation

```bash
npm i --save-exact @remotion/whisper-webgpu@4.0.543 @huggingface/transformers
```

## Example

```ts twoslash title="transcribe.ts"
import {clearStaleModels, downloadWhisperModel, resampleTo16Khz, toCaptions, transcribe} from '@remotion/whisper-webgpu';

export const transcribeFile = async (file: File) => {
  await clearStaleModels();
  await downloadWhisperModel({model: 'small.en'});

  const channelWaveform = await resampleTo16Khz({file});
  const transcription = await transcribe({
    channelWaveform,
    model: 'small.en',
    language: 'en',
  });

  const {captions} = toCaptions({whisperWebGpuOutput: transcription});
  return captions;
};
```

## Model hosting

We noticed that hosting the models on R2 leads to faster downloading than through Hugging Face directly.  
We mirrored the models to `remotion.media`, keeping them byte-identical.  
We also notified Hugging Face and they are investigating the issue. We may migrate back to the official hosting in the future.

## On the server

See [`@remotion/whisper-webgpu` in Node.js](/docs/whisper-webgpu/node) for a complete Node.js example.

## APIs

- [canUseWhisperWebGpu()](https://www.remotion.dev/docs/whisper-webgpu/can-use-whisper-webgpu.md) — Check whether transcription is possible
- [getAvailableModels()](https://www.remotion.dev/docs/whisper-webgpu/get-available-models.md) — List models and their download sizes
- [clearStaleModels()](https://www.remotion.dev/docs/whisper-webgpu/clear-stale-models.md) — Remove models discontinued by newer versions
- [isWhisperModelCached()](https://www.remotion.dev/docs/whisper-webgpu/is-whisper-model-cached.md) — Check whether a model is downloaded
- [downloadWhisperModel()](https://www.remotion.dev/docs/whisper-webgpu/download-whisper-model.md) — Download a model
- [loadWhisperModel()](https://www.remotion.dev/docs/whisper-webgpu/load-whisper-model.md) — Initialize a downloaded model
- [disposeWhisperModel()](https://www.remotion.dev/docs/whisper-webgpu/dispose-whisper-model.md) — Release model memory
- [removeWhisperModel()](https://www.remotion.dev/docs/whisper-webgpu/remove-whisper-model.md) — Remove a model from the persistent cache
- [transcribe()](https://www.remotion.dev/docs/whisper-webgpu/transcribe.md) — Transcribe a waveform with word-level timestamps
- [toCaptions()](https://www.remotion.dev/docs/whisper-webgpu/to-captions.md) — Convert a transcription to `@remotion/captions`
- [resampleTo16Khz()](https://www.remotion.dev/docs/whisper-webgpu/resample-to-16khz.md) — Decode and resample browser audio

## Requirements

You obviously need a GPU.  
Use [`canUseWhisperWebGpu()`](/docs/whisper-webgpu/can-use-whisper-webgpu) to determine if it is supported.

## License

MIT
