@remotion/install-whisper-cppv4.0.115
With Whisper.cpp, you can transcribe audio locally on your machine.
This package provides easy to use cross-platform functions to install Whisper.cpp and a model.
- Remotion CLI
- npm
- bun
- pnpm
- yarn
npx remotion add @remotion/install-whisper-cpp
This assumes you are currently using v4.0.426 of Remotion.npm i --save-exact @remotion/install-whisper-cpp@4.0.426
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.This assumes you are currently using v4.0.426 of Remotion.pnpm i @remotion/install-whisper-cpp@4.0.426
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.This assumes you are currently using v4.0.426 of Remotion.bun i @remotion/install-whisper-cpp@4.0.426
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.This assumes you are currently using v4.0.426 of Remotion.yarn --exact add @remotion/install-whisper-cpp@4.0.426
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.Example usage
Install Whisper 1.5.5 (the latest version at the time of writing that we find works well and supports token-level timestamps) and the medium.en model to the whisper.cpp folder.
import path from 'path';
import {downloadWhisperModel , installWhisperCpp , transcribe , toCaptions } from '@remotion/install-whisper-cpp';
import fs from 'fs';
const to = path .join (process .cwd (), 'whisper.cpp');
await installWhisperCpp ({
to ,
version : '1.5.5',
});
await downloadWhisperModel ({
model : 'medium.en',
folder : to ,
});
// Convert the audio to a 16KHz wav file first if needed:
// import {execSync} from 'child_process';
// execSync('ffmpeg -i /path/to/audio.mp4 -ar 16000 /path/to/audio.wav -y');
const whisperCppOutput = await transcribe ({
model : 'medium.en',
whisperPath : to ,
whisperCppVersion : '1.5.5',
inputPath : '/path/to/audio.wav',
tokenLevelTimestamps : true,
});
// Optional: Apply our recommended postprocessing
const {captions } = toCaptions ({
whisperCppOutput ,
});
fs .writeFileSync ('captions.json', JSON .stringify (captions , null, 2));Functions
License
MIT