( dir: string, inputPaths: string[], options: FfmpegOptions )
| 470 | } |
| 471 | |
| 472 | async function overlayImage( |
| 473 | dir: string, |
| 474 | inputPaths: string[], |
| 475 | options: FfmpegOptions |
| 476 | ): Promise<FfmpegResult> { |
| 477 | if (inputPaths.length < 2) throw new Error('overlay_image requires [video, image]') |
| 478 | const xy = OVERLAY_POSITION[options.position || 'top-right'] || OVERLAY_POSITION['top-right'] |
| 479 | const outputPath = path.join(dir, 'out.mp4') |
| 480 | const command = ffmpeg() |
| 481 | .input(inputPaths[0]) |
| 482 | .input(inputPaths[1]) |
| 483 | .complexFilter([`[0:v][1:v]overlay=${xy}[v]`]) |
| 484 | .outputOptions(['-map', '[v]', '-map', '0:a?', '-c:a', 'copy']) |
| 485 | await runCommand(command, outputPath) |
| 486 | return readOut(outputPath, 'mp4') |
| 487 | } |
| 488 | |
| 489 | async function addText( |
| 490 | dir: string, |
no test coverage detected