Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save worldadventurer/f21539ca351dbf82cdf8b6747745f037 to your computer and use it in GitHub Desktop.
Save worldadventurer/f21539ca351dbf82cdf8b6747745f037 to your computer and use it in GitHub Desktop.
FreePBX Asterisk - install latest ffmpeg on Centos 6
# Tested on Centos 6 x64
echo This installs ffmpeg on your system.
echo This takes 20-60 minutes!
read -rsp $'Press any key to continue OR CTRL-c to QUIT ...\n' -n1 key
#
# source: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
yum -y install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel freetype-devel speex-devel
mkdir ~/ffmpeg_sources
# Yasm is an assembler used by x264 and FFmpeg
cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/yasm/yasm.git
cd yasm
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
make distclean
. ~/.bash_profile
# x264/H264 video encoder
cd ~/ffmpeg_sources
git clone --depth 1 git://git.videolan.org/x264
cd x264
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
make distclean
# AAC audio encoder
cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
# lame is an mp3 audio encoder
cd ~/ffmpeg_sources
curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm
make
make install
make distclean
# Opus audio decoder and encoder
cd ~/ffmpeg_sources && curl -O http://downloads.xiph.org/releases/opus/opus-1.1.4.tar.gz
tar xzvf opus-1.1.4.tar.gz && cd opus-1.1.4
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make && make install && make distclean
# Ogg bitstream library. Required by libtheora and libvorbis.
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
tar xzvf libogg-1.3.2.tar.gz
cd libogg-1.3.2
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
# Vorbis audio encoder
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz
tar xzvf libvorbis-1.3.5.tar.gz
cd libvorbis-1.3.5
./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
# VP8/VP9 video encoder
# Note the latest source from git didnt work so had to use a specific version
cd ~/ffmpeg_sources
curl -O http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.6.1.tar.bz2
tar -jxf libvpx-1.6.1.tar.bz2
cd libvpx-1.6.1
./configure --prefix="$HOME/ffmpeg_build" --disable-examples
make
make install
make distclean
# Theora audio and video encoders, can be used instead of Vorbis audio encoder
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-examples --disable-shared --disable-sdltest --disable-vorbistest
make
make install
make distclean
# Finally install ffmpeg
cd ~/ffmpeg_sources
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
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-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libfreetype --enable-libspeex --enable-libtheora
make
make install
make distclean
hash -r
. ~/.bash_profile
cd ~/ffmpeg_sources/ffmpeg/tools
make qt-faststart
cp qt-faststart /usr/bin
ldconfig
cd
# Copy over newly compiled binaries to system for Asterisk to use
# Below may not work on your system. This works on a Centos 6 x64
echo =================
echo == DONE installing ==
echo Next I will copy the binaries to system bin for shared use.
read -rsp $'Press any key to continue OR CTRL-c to QUIT ...\n' -n1 key
cp ~/bin/* /usr/bin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment