( dir: string, inputPath: string, input: MediaFile, options: FfmpegOptions )
| 429 | } |
| 430 | |
| 431 | async function trim( |
| 432 | dir: string, |
| 433 | inputPath: string, |
| 434 | input: MediaFile, |
| 435 | options: FfmpegOptions |
| 436 | ): Promise<FfmpegResult> { |
| 437 | const ext = extFromMime(input.mimeType) |
| 438 | const outputPath = path.join(dir, `out.${ext}`) |
| 439 | const start = options.start ?? 0 |
| 440 | const command = ffmpeg(inputPath).setStartTime(start) |
| 441 | if (options.end !== undefined) { |
| 442 | command.setDuration(Math.max(0, options.end - start)) |
| 443 | } |
| 444 | await runCommand(command, outputPath) |
| 445 | return readOut(outputPath, ext) |
| 446 | } |
| 447 | |
| 448 | async function scalePad( |
| 449 | dir: string, |
no test coverage detected