@remotion/install-whisper-cpp 4.0.256 → 4.0.257
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -57,10 +57,10 @@ const modelSizes = {
|
|
|
57
57
|
'small.en': 487614201,
|
|
58
58
|
'tiny.en': 77704715,
|
|
59
59
|
base: 147951465,
|
|
60
|
-
medium:
|
|
60
|
+
medium: 1533763059,
|
|
61
61
|
};
|
|
62
62
|
const getModelPath = (folder, model) => {
|
|
63
|
-
return path_1.default.join(folder, `ggml-${model}.bin`);
|
|
63
|
+
return path_1.default.join(path_1.default.resolve(process.cwd(), folder), `ggml-${model}.bin`);
|
|
64
64
|
};
|
|
65
65
|
exports.getModelPath = getModelPath;
|
|
66
66
|
const downloadWhisperModel = async ({ model, folder, printOutput = true, onProgress, signal, }) => {
|
|
@@ -110,8 +110,8 @@ const installWhisperForUnix = async ({ version, to, printOutput, signal, }) => {
|
|
|
110
110
|
};
|
|
111
111
|
const getWhisperExecutablePath = (whisperPath) => {
|
|
112
112
|
return os_1.default.platform() === 'win32'
|
|
113
|
-
? path_1.default.join(whisperPath, 'main.exe')
|
|
114
|
-
: path_1.default.join(whisperPath, './main');
|
|
113
|
+
? path_1.default.join(path_1.default.resolve(process.cwd(), whisperPath), 'main.exe')
|
|
114
|
+
: path_1.default.join(path_1.default.resolve(process.cwd(), whisperPath), './main');
|
|
115
115
|
};
|
|
116
116
|
exports.getWhisperExecutablePath = getWhisperExecutablePath;
|
|
117
117
|
const installWhisperCpp = async ({ version, to, printOutput = true, signal, }) => {
|
package/dist/transcribe.js
CHANGED
|
@@ -86,7 +86,7 @@ const transcribeToTemporaryFile = async ({ fileToTranscribe, whisperPath, model,
|
|
|
86
86
|
.filter(Boolean);
|
|
87
87
|
const outputPath = await new Promise((resolve, reject) => {
|
|
88
88
|
const task = (0, node_child_process_1.spawn)(executable, args, {
|
|
89
|
-
cwd: whisperPath,
|
|
89
|
+
cwd: node_path_1.default.resolve(process.cwd(), whisperPath),
|
|
90
90
|
signal: signal !== null && signal !== void 0 ? signal : undefined,
|
|
91
91
|
});
|
|
92
92
|
const predictedPath = `${tmpJSONPath}.json`;
|
|
@@ -104,10 +104,13 @@ const transcribeToTemporaryFile = async ({ fileToTranscribe, whisperPath, model,
|
|
|
104
104
|
task.kill();
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
+
let stderr = '';
|
|
107
108
|
const onStderr = (data) => {
|
|
108
109
|
onData(data);
|
|
110
|
+
const utf8 = data.toString('utf-8');
|
|
111
|
+
stderr += utf8;
|
|
109
112
|
if (printOutput) {
|
|
110
|
-
process.stderr.write(
|
|
113
|
+
process.stderr.write(utf8);
|
|
111
114
|
}
|
|
112
115
|
};
|
|
113
116
|
const onStdout = (data) => {
|
|
@@ -130,6 +133,9 @@ const transcribeToTemporaryFile = async ({ fileToTranscribe, whisperPath, model,
|
|
|
130
133
|
reject(new Error(`Process was killed with signal ${exitSignal}: ${output}`));
|
|
131
134
|
return;
|
|
132
135
|
}
|
|
136
|
+
if (stderr.includes('must be 16 kHz')) {
|
|
137
|
+
reject(new Error('wav file must be 16 kHz - use this command to make it so: "ffmpeg -i input.wav -ar 16000 output.wav -y"'));
|
|
138
|
+
}
|
|
133
139
|
reject(new Error(`No transcription was created (process exited with code ${code}): ${output}`));
|
|
134
140
|
});
|
|
135
141
|
});
|
|
@@ -143,7 +149,7 @@ const transcribe = async ({ inputPath, whisperPath, model, modelFolder, translat
|
|
|
143
149
|
throw new Error(`Input file does not exist at ${inputPath}`);
|
|
144
150
|
}
|
|
145
151
|
if (!isWavFile(inputPath)) {
|
|
146
|
-
throw new Error('Invalid inputFile type. The provided file is not a wav file!');
|
|
152
|
+
throw new Error('Invalid inputFile type. The provided file is not a wav file! Convert the file to a 16KHz wav file first: "ffmpeg -i input.mp4 -ar 16000 output.wav -y"');
|
|
147
153
|
}
|
|
148
154
|
const tmpJSONDir = node_path_1.default.join(process.cwd(), 'tmp');
|
|
149
155
|
const { outputPath: tmpJSONPath } = await transcribeToTemporaryFile({
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/install-whisper-cpp"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/install-whisper-cpp",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.257",
|
|
7
7
|
"description": "Helpers for installing and using Whisper.cpp",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
17
17
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@remotion/captions": "4.0.
|
|
19
|
+
"@remotion/captions": "4.0.257"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"eslint": "9.14.0",
|
|
24
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
24
|
+
"@remotion/eslint-config-internal": "4.0.257"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"remotion",
|