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

Function overlayAudio

apps/sim/lib/media/ffmpeg.ts:301–327  ·  view source on GitHub ↗
(
  dir: string,
  inputPaths: string[],
  options: FfmpegOptions
)

Source from the content-addressed store, hash-verified

299}
300
301async 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
329async function mixAudio(
330 dir: string,

Callers 1

runFfmpegOperationFunction · 0.85

Calls 3

readOutFunction · 0.85
joinMethod · 0.80
runCommandFunction · 0.70

Tested by

no test coverage detected