【问题标题】:ffmpeg error on AWS lambdaAWS lambda上的ffmpeg错误
【发布时间】:2018-08-21 21:17:31
【问题描述】:

我正在尝试将 jpg 图像转换为 mp4 并在 AWS lambda 上使用 ffmpeg 对 mp4 文件进行转码。

对于第一个任务,我发出以下命令:

ffmpeg -y -f lavfi -i anullsrc -loop 1 -framerate 30 -i test.jpg -t 2 -pix_fmt yuv420p -vf scale=640:480 -c:v libx264 -profile:v baseline -level 3.0 -c:a aac -map 0:a -map 1:v -strict -2 -preset ultrafast /tmp/jpg_output.mp4

第二个:

ffmpeg -i /var/task/test.mp4 -c:v libx264 -c:a copy -strict -2 -v 9 -preset ultrafast -y /tmp/output.mp4

有趣的是,上述任务(jpg 转换和视频转码)在本地和 AWS lambda 上均成功完成,但我收到以下错误消息:

本地:“错误:ffmpeg 版本 3.4.2 版权所有 (c) 2000-2018 FFmpeg 开发人员

AWS LAMBDA:“错误:ffmpeg 版本 N-89977-gddd851f7cb-static https://johnvansickle.com/ffmpeg/ 版权所有 (c) 2000-2018 FFmpeg 开发人员

此外,在 AWS Lambda 上,函数退出并出现错误,导致函数重新执行。

我寻找解决方案无济于事。有什么建议吗?

【问题讨论】:

  • t 2 更改为 -t 2。移除 -strict -2,因为 FFmpeg AAC 编码器已经有几年没有实验了。

标签: amazon-web-services ffmpeg aws-lambda


【解决方案1】:

删除或更新命令行中的-v 9。根据Generic Option Docs,详细程度为:

-loglevel [repeat+]loglevel | -v [repeat+]loglevel

    Set the logging level used by the library. Adding "repeat+" indicates that repeated log output should not be compressed to the first line and the "Last message repeated n times" line will be omitted. "repeat" can also be used alone. If "repeat" is used alone, and with no prior loglevel set, the default loglevel will be used. If multiple loglevel parameters are given, using ’repeat’ will not change the loglevel. loglevel is a string or a number containing one of the following values:

    ‘quiet, -8’

        Show nothing at all; be silent. 
    ‘panic, 0’

        Only show fatal errors which could lead the process to crash, such as an assertion failure. This is not currently used for anything. 
    ‘fatal, 8’

        Only show fatal errors. These are errors after which the process absolutely cannot continue. 
    ‘error, 16’

        Show all errors, including ones which can be recovered from. 
    ‘warning, 24’

        Show all warnings and errors. Any message related to possibly incorrect or unexpected events will be shown. 
    ‘info, 32’

        Show informative messages during processing. This is in addition to warnings and errors. This is the default value. 
    ‘verbose, 40’

        Same as info, except more verbose. 
    ‘debug, 48’

        Show everything, including debugging information. 
    ‘trace, 56’

如果我运行ffmpeg -v 9,程序退出,值为 1,表示失败。

【讨论】:

  • 删除-v 和/或将-loglevel 更新为-loglevel 0-8 无济于事。仍然输出err:。正如您假设它在本地和 AWS 上完成任务,但在第二次,由于日志中的err:,它会尝试再次执行。
  • 你的编程环境是什么?最终看起来ffmpeg 退出代码不为零(表示成功运行)。也许有不止一个问题 - 您是否尝试过 @LordNeckbeard 的建议?
猜你喜欢
  • 1970-01-01
  • 2018-09-22
  • 2017-02-11
  • 1970-01-01
  • 2021-11-10
  • 2019-03-14
  • 1970-01-01
  • 2019-02-14
  • 2019-05-01
相关资源
最近更新 更多