Installing ffmpeg on EC2 AMI Centos

May 09, 2016 by admin Category: Blog 0 comments
sudo touch ffmpeg.sh
sudo vim ffmpeg.sh

copy the code below in a file and run.

#!/bin/sh

# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264

if [ "`/usr/bin/whoami`" != "root" ]; then
    echo "You need to execute this script as root."
    exit 1
fi

cat > /etc/yum.repos.d/centos.repo<> /etc/ld.so.conf.d/custom-libs.conf
echo $HOME/ffmpeg_build/lib/ >> /etc/ld.so.conf.d/custom-libs.conf
ldconfig

cd /opt
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
git checkout release/2.2
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"
export PKG_CONFIG_PATH
./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" \
--extra-libs=-ldl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac \
--enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libvo-aacenc --enable-libxvid --disable-ffplay \
--enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --arch=x86_64 && make install

# Test the resulting ffmpeg binary
cp $HOME/bin/ffmpeg /usr/bin/
which ffmpeg

Now run the code.

sh ffmpeg.sh

Leave a Comment!

Your email address will not be published. Required fields are marked *