问题描述
将 elasticbeanstalk 与运行在 64 位 Amazon Linux 2/5.2.3 上的 Node.js 10 结合使用。我在 .ebextensions 文件夹下有一个 packages.config 文件。
packages:
yum:
ImageMagick: []
ImageMagick-devel: []
commands:
01-wget:
command: "wget -O /tmp/ffmpeg.tar.xz http://ffmpeg.org/releases/ffmpeg-4.1.tar.gz"
02-mkdir:
command: "if [ ! -d /opt/ffmpeg ] ; then mkdir -p /opt/ffmpeg; fi"
03-tar:
command: "tar xvf /tmp/ffmpeg.tar.xz -C /opt/ffmpeg"
04-ln:
command: "if [[ ! -f /usr/bin/ffmpeg ]] ; then ln -sf /opt/ffmpeg/ffmpeg-4.1/ffmpeg /usr/bin/ffmpeg; fi"
05-ln:
command: "if [[ ! -f /usr/bin/ffprobe ]] ; then ln -sf /opt/ffmpeg/ffmpeg-4.1/ffprobe /usr/bin/ffprobe; fi"
06-pecl:
command: "if [ `pecl list | grep imagick` ] ; then pecl install -f imagick; fi"
我正在使用 fluent-ffmpeg@2.1.2 模块来保存屏幕截图。
解决方法
您只是在下载和解压 ffmpeg
的源代码。在使用 ffmpeg
和 ffprobe
之前,您必须编译代码。没有这个,你的脚本将无法工作。
要编译,您可以尝试在 /opt/ffmpeg/ffmpeg-4.1
文件夹中运行以下命令:
./configure --disable-x86asm
make
但是,编译将耗时。这可能会更好地编译所有内容,例如将二进制文件存储在 S3 中,或者与您的应用程序 zip 捆绑在一起,以节省大量时间。