【问题标题】:Losing audio when overlaying videos with fluent ffmpeg使用流利的 ffmpeg 覆盖视频时丢失音频
【发布时间】:2021-11-27 22:11:06
【问题描述】:

我有一个主要视频文件和动态数量的较小视频文件,需要根据时间戳在特定时间叠加。

我能够将视频叠加在正确的位置,但现在我没有任何音频。 (注意:我只需要第一个输入的音频,因为覆盖的视频没有音频)

我认为这是我的输入语法问题,但无法完全弄清楚。 任何帮助表示赞赏。

这是我的代码:

 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");



【问题讨论】:

    标签: javascript ffmpeg fluent fluent-ffmpeg


    【解决方案1】:

    看来我需要添加一个输出选项来映射原始视频中的音频。

     mergedVideo
              .complexFilter(filters, "tmp")
              .outputOptions(["-map 0:a"])
              .output("/tmp/final.mp4")
              .run();
    

    【讨论】:

      猜你喜欢
      • 2019-03-13
      • 2019-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-19
      • 1970-01-01
      • 2021-03-14
      • 1970-01-01
      相关资源
      最近更新 更多