( dir: string, inputPaths: string[], options: FfmpegOptions )
| 299 | } |
| 300 | |
| 301 | async function overlayAudio( |
| 302 | dir: string, |
| 303 | inputPaths: string[], |
| 304 | options: FfmpegOptions |
| 305 | ): Promise<FfmpegResult> { |
| 306 | if (inputPaths.length < 2) throw new Error('overlay_audio requires [video, audio]') |
| 307 | const outputPath = path.join(dir, 'out.mp4') |
| 308 | const command = ffmpeg().input(inputPaths[0]) |
| 309 | if (options.loopToVideo) { |
| 310 | command.input(inputPaths[1]).inputOptions(['-stream_loop', '-1']) |
| 311 | } else { |
| 312 | command.input(inputPaths[1]) |
| 313 | } |
| 314 | command.outputOptions([ |
| 315 | '-map', |
| 316 | '0:v:0', |
| 317 | '-map', |
| 318 | '1:a:0', |
| 319 | '-c:v', |
| 320 | 'copy', |
| 321 | '-c:a', |
| 322 | 'aac', |
| 323 | '-shortest', |
| 324 | ]) |
| 325 | await runCommand(command, outputPath) |
| 326 | return readOut(outputPath, 'mp4') |
| 327 | } |
| 328 | |
| 329 | async function mixAudio( |
| 330 | dir: string, |
no test coverage detected