FFmpeg is a program used for video manipulation. However, it is not available through yum for installation on Elastic Beanstalk. Other methods, such as pulling from the DAG repository are obsolete. Instead, FFmpeg can easily be installed from source to your Elastic Beanstalk instance.
If you don’t already have an .ebextensions
directory in the root of your app directory, create it:
1
$ mkdir .ebextensions
Next create a file called ffmpeg.config
in the .ebextensions
folder, and add the following code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# .ebextensions/ffmpeg.config
packages:
yum:
autoconf: []
automake: []
cmake: []
freetype-devel: []
gcc: []
gcc-c++: []
git: []
libtool: []
make: []
nasm: []
pkgconfig: []
zlib-devel: []
sources:
/usr/local/src: http://ffmpeg.org/releases/ffmpeg-3.2.tar.bz2
commands:
ffmpeg_install:
cwd: /usr/local/src/ffmpeg-3.2
command: sudo ./configure --prefix=/usr && make && make install
Let’s step through this configuration file. The packages
line of this file tells Elastic Beanstalk to install several packages through yum that are dependencies of FFmpeg. Next, the sources
line instructs Elastic Beanstalk to download and unzip the ffmpeg tarball into the /usr/local/src
directory. The commands
line then tells Elastic Beanstalk to change into the newly unpacked ffmpeg-3.2 directory, and configure and install FFmpeg.
Ordinarily it is a good practice to install packages from source into the /usr/local
directory. However, if you have a Rails application running, the default webapp
user that runs the application may not have /usr/local
in its PATH
. Installing ffmpeg
in the /usr
directory ensures it will be available to the web application in /usr/bin
.