Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
Losing audio when overlaying videos with fluent ffmpeg

I have one main video file and a dynamic number of smaller video files that need to be overlayed at specific times based on timestamps.

I was able to get the video to overlay at the correct spots but now I don't have any audio. (Note: I only need audio from the first input as the overlayed videos have no audio)

I believe it is an issue with my syntax around the inputs, but can't quite figure it out. Any help is appreciated.

Here is my code:

 const mergedVideo = ffmpeg("/tmp/orignal.mp4");
 screenShareFileNames.forEach((fileName) => mergedVideo.addInput(fileName));

 const filters = screenShareFileNames.map((fileName, index) => {
    const inputs = index === 0 ? "[0:v][1:v]" : `[tmp][${index + 1}:v]`;
    const outputs = `tmp`;
          
    return {
            filter: "overlay",
            options: { enable: `between(t,${insertPoint},${insertPoint + 5})` },
            inputs,
            outputs,
          };
  });

  mergedVideo
     .complexFilter(filters, "tmp")
     .save("/tmp/final.mp4");



about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It appears I needed to add an outputOptions that mapped the audio from the orginal video.

 mergedVideo
          .complexFilter(filters, "tmp")
          .outputOptions(["-map 0:a"])
          .output("/tmp/final.mp4")
          .run();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!