gpt4 book ai didi

node.js - ffmpeg 在 ChildProcess 出现代码 1 失败

转载 作者:行者123 更新时间:2023-12-04 23:07:16 25 4
gpt4 key购买 nike

我正在尝试使用firebase函数和ffmpeg在firebase存储中的视频上添加水印,
但无论我尝试什么,它总是退出相同的错误。

 return spawn('ffmpeg', ['-i', tmpFilePath, '-vf',`drawtext="text='hello World'`, tmpFilePath]);
我也试过这个:
        return spawn('ffmpeg', ['-i', tmpFilePath, '-i', tmpLogoPath, '-filter_complex', '"overlay=10:10"', tmpFilePath]);
控制台日志:
ChildProcessError: `ffmpeg -i /tmp/anything -vf drawtext="text='Stack Overflow' /tmp/anything` failed with code 1
at ChildProcess.<anonymous> (/workspace/node_modules/child-process-promise/lib/index.js:132:23)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:506:15)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:443:11)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:506:15)
at Pipe.<anonymous> (net.js:674:12)
at Pipe.callbackTrampoline (internal/async_hooks.js:120:14)

最佳答案

经过多次尝试,我发现如果我通过变量而不是直接传递“overlay=10:10”,这将起作用,这段代码对我有用。

var str = "overlay=10:10"
return spawn('ffmpeg', ['-i', tmpFilePath, '-i', tmpLogoPath, '-filter_complex', str, tmpFilePath]);

关于node.js - ffmpeg 在 ChildProcess 出现代码 1 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65648316/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com