(inputPath: string, outputPath: string)
| 139 | // hasFFmpeg is imported from whisper/manager.ts to avoid duplication |
| 140 | |
| 141 | function transcodeToMp4(inputPath: string, outputPath: string): Promise<boolean> { |
| 142 | return new Promise((resolvePromise) => { |
| 143 | const ffmpegPath = findFFmpeg(); |
| 144 | if (!ffmpegPath) { |
| 145 | resolvePromise(false); |
| 146 | return; |
| 147 | } |
| 148 | const child = spawn( |
| 149 | ffmpegPath, |
| 150 | [ |
| 151 | "-i", |
| 152 | inputPath, |
| 153 | "-c:v", |
| 154 | "libx264", |
| 155 | "-preset", |
| 156 | "fast", |
| 157 | "-crf", |
| 158 | "18", |
| 159 | "-c:a", |
| 160 | "aac", |
| 161 | "-b:a", |
| 162 | "192k", |
| 163 | "-y", |
| 164 | outputPath, |
| 165 | ], |
| 166 | { stdio: "pipe" }, |
| 167 | ); |
| 168 | |
| 169 | child.on("close", (code) => resolvePromise(code === 0)); |
| 170 | child.on("error", () => resolvePromise(false)); |
| 171 | }); |
| 172 | } |
| 173 | |
| 174 | // --------------------------------------------------------------------------- |
| 175 | // Static template helpers |
no test coverage detected