问题描述
我正在 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 (将#修改为@)