简体   繁体   English

我需要将音频和视频 stream 与流利的 ffmpeg 结合起来

[英]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.我需要获取一个输入流的音频和另一个流的视频,并将它们与 fluent-ffmpeg 结合起来。 I am using nodejs.我正在使用nodejs。 Also, I need to pipe the output.另外,我需要 pipe 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.两个输入都有视频和音频,但我只需要合并流的音频,同时对另一个 stream 上的视频做同样的事情。

Thank you.谢谢你。

you don't need to use fluent-ffmpeg, if you have ffmpeg installed on your machine you can use child-process .你不需要使用 fluent-ffmpeg,如果你的机器上安装了 ffmpeg 你可以使用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我从如何使用 ffmpeg 组合音频和视频中得到了这个命令

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

; ;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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