ffmpeg 在 ChildProcess 失败,代码为 1
ffmpwg failed with code 1 at ChildProcess
我正在尝试使用 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]);
删除叠加层周围的双引号,然后像这样重试:
return spawn('ffmpeg', ['-i', tmpFilePath, '-i', tmpLogoPath, '-filter_complex', 'overlay=10:10', tmpFilePath]);
我正在尝试使用 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]);
删除叠加层周围的双引号,然后像这样重试:
return spawn('ffmpeg', ['-i', tmpFilePath, '-i', tmpLogoPath, '-filter_complex', 'overlay=10:10', tmpFilePath]);