且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ffmpeg在AWS Lamda函数中返回错误代码1

更新时间:2023-01-14 22:01:58

您必须使用 -f格式选项告诉ffmpeg您希望输出什么格式.运行 ffmpeg -formats 以获得支持的格式列表.

You have to tell ffmpeg what format you want the output in using the -f format option. Run ffmpeg -formats to get the list of supported formats.

ffmpeg文档:

-f fmt(输入/输出)强制输入或输出文件格式.通常会自动检测输入文件的格式,并根据输出文件的文件扩展名猜测格式,因此在大多数情况下不需要此选项.

-f fmt (input/output) Force input or output file format. The format is normally auto detected for input files and guessed from the file extension for output files, so this option is not needed in most cases.

例如,如果您希望输出为MPEG-4,则对ffmpeg的调用应如下所示:

For example, if you want the output as MPEG-4, then your call to ffmpeg should look like this:

   var ffmpeg = child_process.spawn("ffmpeg", [
     "-i", target, // url to stream from
     "-i", watermarkPath,
     "-filter_complex" ,"overlay=x=W-w-10:y=H-h-10:format=rgb,format=yuv420p",
     "-c:a", "copy",
     "-f", "m4v",
     "pipe:1"
   ]);