@remotion/install-whisper-cpp
从v4.0.115版本开始可用
使用Whisper.cpp,您可以在本地计算机上转录音频。
该软件包提供了易于使用的跨平台功能,用于安装Whisper.cpp和一个模型。
- npm
- yarn
- pnpm
- bun
npm i --save-exact @remotion/install-whisper-cpp@4.0.206
npm i --save-exact @remotion/install-whisper-cpp@4.0.206
pnpm i @remotion/install-whisper-cpp@4.0.206
pnpm i @remotion/install-whisper-cpp@4.0.206
bun i @remotion/install-whisper-cpp@4.0.206
bun i @remotion/install-whisper-cpp@4.0.206
yarn --exact add @remotion/install-whisper-cpp@4.0.206
yarn --exact add @remotion/install-whisper-cpp@4.0.206
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.示例用法
将Whisper安装为1.5.5
(在撰写时我们发现的最新版本,支持令牌级时间戳)并将medium.en
模型安装到whisper.cpp
文件夹中。
install-whisper.cpptsx
importpath from "path";import {downloadWhisperModel ,installWhisperCpp ,transcribe ,convertToCaptions ,} from "@remotion/install-whisper-cpp";constto =path .join (process .cwd (), "whisper.cpp");awaitinstallWhisperCpp ({to ,version : "1.5.5",});awaitdownloadWhisperModel ({model : "medium.en",folder :to ,});const {transcription } = awaittranscribe ({model : "medium.en",whisperPath :to ,inputPath : "/path/to/audio.wav",tokenLevelTimestamps : true,});for (consttoken oftranscription ) {console .log (token .timestamps .from ,token .timestamps .to ,token .text );}// Optional: Apply our recommended postprocessingconst {captions } =convertToCaptions ({transcription ,combineTokensWithinMilliseconds : 200,});for (constline ofcaptions ) {console .log (line .text ,line .startInSeconds );}
install-whisper.cpptsx
importpath from "path";import {downloadWhisperModel ,installWhisperCpp ,transcribe ,convertToCaptions ,} from "@remotion/install-whisper-cpp";constto =path .join (process .cwd (), "whisper.cpp");awaitinstallWhisperCpp ({to ,version : "1.5.5",});awaitdownloadWhisperModel ({model : "medium.en",folder :to ,});const {transcription } = awaittranscribe ({model : "medium.en",whisperPath :to ,inputPath : "/path/to/audio.wav",tokenLevelTimestamps : true,});for (consttoken oftranscription ) {console .log (token .timestamps .from ,token .timestamps .to ,token .text );}// Optional: Apply our recommended postprocessingconst {captions } =convertToCaptions ({transcription ,combineTokensWithinMilliseconds : 200,});for (constline ofcaptions ) {console .log (line .text ,line .startInSeconds );}
函数
许可证
MIT