在 Node.js 中使用 ffmpeg 将图像放在视频上

问题描述

我正在 node.js 中创建服务器端视频渲染器。我需要每帧在现有视频文件添加图像。我需要在渲染的视频中设置每一帧的具体位置。我在 Readable 中保存了图像的所有帧。这是我的代码有效,但没有考虑图像的位置。我该如何修改它?当然,我有一个包含图像坐标的列表 - 但我不知道如何从中制作过滤器。

this.stream 是图像列表。

  const filter = ["[1:v]format=argb,setpts=PTS+" + 0 + "/TB[out]",{
            filter: "overlay",options: {
                enable: "between(t," + 0 + "," + 9 + ")",x: "0",y: "0",},inputs: "[0:v][out]",outputs: "tmp",}

        ]
        const Options = [
            "-crf 16","-f mp4","-vcodec libx264","-movflags frag_keyframe+empty_moov","-pix_fmt yuv420p",];

        var ffmpeg = require('fluent-ffmpeg');
        ffmpeg.setFfmpegPath(ffm.path);
        var command = ffmpeg();

        const outputStream = fs.createWriteStream(this.Path + "test.mp4");

        command.input(this.Path + "input.mp4");
        command.input(this.stream).inputFPS(23);
        command.outputoptions(Options);
        command.fps(23);

        command.complexFilter(filter,"tmp");

        command.output(outputStream);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...