Skip to content

Instantly share code, notes, and snippets.

@cdgraff
Last active December 27, 2016 11:19
Show Gist options
  • Save cdgraff/b1d35c66cd8eb978143b to your computer and use it in GitHub Desktop.
Save cdgraff/b1d35c66cd8eb978143b to your computer and use it in GitHub Desktop.
install-avconv-amazon-linux-2014.09
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
# and modified to works with libav and some extra improvements
# Updated 09/01/2015 by Alejandro Ferrari (www.wmconsulting.info)
# Tested with Amazon Linux 2014.09 and Centos 6.6
# can download Docker image with AVCONV build from here:
# URL Docker
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
if [ -d "$HOME/avconv_build" ]; then
echo "Deleting existing avconv build directory"
rm -rf $HOME/avconv_build
fi
if [ -d "/opt/avconv_deps" ]; then
echo "Deleting existing avconv deps directory"
rm -rf /opt/avconv_deps
fi
if [ ! -d "/opt/avconv_deps" ]; then
echo "Creating avconv deps directory"
mkdir -p /opt/avconv_deps
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
[centos]
name=CentOS-6 – Base
baseurl=http://mirror.centos.org/centos/6/os/x86_64/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
enabled=1
priority=1
protect=1
includepkgs=SDL SDL-devel gsm gsm-devel libtheora theora-tools libdc1394 libdc1394-devel libraw1394-devel
EOF
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
rpm -Uhv http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
## add epel repo here:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y update
yum -y install glibc gcc gcc-c++ autoconf automake libtool git make nasm pkgconfig tar wget
yum -y install SDL-devel a52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel
yum -y install freetype-devel giflib gsm gsm-devel imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel fontconfig-devel
yum -y install libXau-devel libXdmcp-devel libXext-devel libXrandr-devel libXrender-devel libXt-devel
yum -y install libogg libvorbis vorbis-tools mesa-libGL-devel mesa-libGLU-devel xorg-x11-proto-devel zlib-devel
yum -y install libtheora theora-tools openssl-devel
yum -y install ncurses-devel
yum -y install libdc1394 libdc1394-devel
yum -y install amrnb-devel amrwb-devel opencore-amr-devel
yum -y install --enablerepo=epel yasm-devel libvpx-devel
cd /opt/avconv_deps
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
tar xzvf xvidcore-1.3.2.tar.gz && rm -f xvidcore-1.3.2.tar.gz
cd xvidcore/build/generic
./configure --prefix="$HOME/avconv_build" && make && make install
cd /opt/avconv_deps
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gz
tar xzvf libogg-1.3.1.tar.gz && rm -f libogg-1.3.1.tar.gz
cd libogg-1.3.1
./configure --prefix="$HOME/avconv_build" --disable-shared && make && make install
cd /opt/avconv_deps
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
tar xzvf libvorbis-1.3.4.tar.gz && rm -f libvorbis-1.3.4.tar.gz
cd libvorbis-1.3.4
./configure --prefix="$HOME/avconv_build" --with-ogg="$HOME/avconv_build" --disable-shared && make && make install
cd /opt/avconv_deps
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz && rm -f libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure --prefix="$HOME/avconv_build" --with-ogg="$HOME/avconv_build" --disable-examples --disable-shared --disable-sdltest --disable-vorbistest && make && make install
cd /opt/avconv_deps
wget http://downloads.sourceforge.net/opencore-amr/vo-aacenc-0.1.2.tar.gz
tar xzvf vo-aacenc-0.1.2.tar.gz && rm -f vo-aacenc-0.1.2.tar.gz
cd vo-aacenc-0.1.2
./configure --prefix="$HOME/avconv_build" --disable-shared && make install
cd /opt/avconv_deps
git clone git://git.videolan.org/x264.git
cd x264
./configure --prefix="$HOME/avconv_build" --bindir="$HOME/bin" --enable-static && make install
cd /opt/avconv_deps
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --disable-shared --prefix="$HOME/avconv_build" --bindir="$HOME/bin" && make && make install
export LD_LIBRARY_PATH=/usr/local/lib/:$HOME/avconv_build/lib/
echo /usr/local/lib >> /etc/ld.so.conf.d/custom-libs.conf
echo $HOME/avconv_build/lib/ >> /etc/ld.so.conf.d/custom-libs.conf
ldconfig
cd /opt/avconv_deps
git clone https://github.com/libav/libav.git
cd libav
PKG_CONFIG_PATH="$HOME/avconv_build/lib/pkgconfig"
export PKG_CONFIG_PATH
./configure --prefix="$HOME/avconv_build" --extra-cflags="-I$HOME/avconv_build/include" --extra-ldflags="-L$HOME/avconv_build/lib" --bindir="$HOME/bin" \
--extra-libs=-ldl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libfdk_aac \
--enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libvo-aacenc --enable-libxvid --enable-libvpx --disable-avplay \
--enable-gpl --enable-nonfree --enable-avfilter --enable-pthreads \
--enable-libfreetype --enable-libfontconfig \
--enable-openssl --arch=x86_64 && make install
# Test the resulting avconv binary
cp $HOME/bin/avconv /usr/bin/
avconv -version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment