简体   繁体   中英

I need to combine audio and video stream with fluent ffmpeg

I need to take an input stream's audio and another stream's video and combine them with fluent-ffmpeg. I am using nodejs. Also, I need to pipe the output. Both of the inputs have video and audio, but I need to merge a stream's audio only, while doing the same with video on the other stream.

Thank you.

you don't need to use fluent-ffmpeg, if you have ffmpeg installed on your machine you can use child-process .

const {exec} = require("child_process"); 
const command = "ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a aac output.mp4" 

I got this command from how to combine audio and video using ffmpeg

exec(command, (error, stdout, stderr) => {
  if (error) {
    console.error(`exec error: ${error}`);
    return;
  }
  console.log(`stdout: ${stdout}`);
  console.error(`stderr: ${stderr}`);
})

;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM