@remotion/install-whisper-cppv4.0.115
使用 Whisper.cpp,你可以在本地机器上转录音频。 该软件包提供易于使用的跨平台函数来安装 Whisper.cpp 和一个模型。
🌐 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.431 of Remotion.npm i --save-exact @remotion/install-whisper-cpp@4.0.431
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.431 of Remotion.pnpm i @remotion/install-whisper-cpp@4.0.431
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.431 of Remotion.bun i @remotion/install-whisper-cpp@4.0.431
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.431 of Remotion.yarn --exact add @remotion/install-whisper-cpp@4.0.431
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
将 Whisper 1.5.5(在撰写本文时我们发现运行良好并支持令牌级时间戳的最新版本)和 medium.en 模型安装到 whisper.cpp 文件夹。
🌐 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.
install-whisper.cppimportpath from 'path'; import {downloadWhisperModel ,installWhisperCpp ,transcribe ,toCaptions } from '@remotion/install-whisper-cpp'; importfs from 'fs'; constto =path .join (process .cwd (), 'whisper.cpp'); awaitinstallWhisperCpp ({to ,version : '1.5.5', }); awaitdownloadWhisperModel ({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'); constwhisperCppOutput = awaittranscribe ({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
另请参阅
🌐 See also