MCPcopy Index your code
hub / github.com/simstudioai/sim / trim

Function trim

apps/sim/lib/media/ffmpeg.ts:431–446  ·  view source on GitHub ↗
(
  dir: string,
  inputPath: string,
  input: MediaFile,
  options: FfmpegOptions
)

Source from the content-addressed store, hash-verified

429}
430
431async 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
448async function scalePad(
449 dir: string,

Callers 1

runFfmpegOperationFunction · 0.85

Calls 4

extFromMimeFunction · 0.85
readOutFunction · 0.85
joinMethod · 0.80
runCommandFunction · 0.70

Tested by

no test coverage detected