( dir: string, inputPath: string, options: FfmpegOptions )
| 487 | } |
| 488 | |
| 489 | async function addText( |
| 490 | dir: string, |
| 491 | inputPath: string, |
| 492 | options: FfmpegOptions |
| 493 | ): Promise<FfmpegResult> { |
| 494 | if (!options.text) throw new Error('add_text requires text') |
| 495 | const pos = TEXT_POSITION[options.position || 'bottom'] || TEXT_POSITION.bottom |
| 496 | const drawtext = [ |
| 497 | `text='${escapeDrawtext(options.text)}'`, |
| 498 | 'fontcolor=white', |
| 499 | 'fontsize=h/18', |
| 500 | 'box=1', |
| 501 | 'boxcolor=black@0.5', |
| 502 | 'boxborderw=20', |
| 503 | `x=${pos.x}`, |
| 504 | `y=${pos.y}`, |
| 505 | ].join(':') |
| 506 | const outputPath = path.join(dir, 'out.mp4') |
| 507 | const command = ffmpeg(inputPath) |
| 508 | .videoFilters(`drawtext=${drawtext}`) |
| 509 | .outputOptions(['-c:a', 'copy']) |
| 510 | await runCommand(command, outputPath) |
| 511 | return readOut(outputPath, 'mp4') |
| 512 | } |
| 513 | |
| 514 | async function fade( |
| 515 | dir: string, |
no test coverage detected