Skip to content

Instantly share code, notes, and snippets.

@StaymanHou
Last active January 20, 2016 00:45
Show Gist options
  • Save StaymanHou/3e3109231a9810aba638 to your computer and use it in GitHub Desktop.
Save StaymanHou/3e3109231a9810aba638 to your computer and use it in GitHub Desktop.
shell script for a full compilation & installation of ffmpeg on CentOS and Amazon Linux
#!/bin/bash
# date: Jan 7, 2015
# author: Stayman Hou
# please run as root user
# after install, ffmpeg command will be executable for all users, including root and non-root
yum install -y autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
mkdir -p /opt/ffmpeg/ffmpeg_sources
cd /opt/ffmpeg/ffmpeg_sources
git clone --depth 1 git://github.com/yasm/yasm.git
cd yasm
autoreconf -fiv
./configure --prefix="/opt/ffmpeg/ffmpeg_build" --bindir="/opt/ffmpeg/bin"
make
make install
make distclean
export PATH=$PATH:/opt/ffmpeg/bin
cd /opt/ffmpeg/ffmpeg_sources
git clone --depth 1 git://git.videolan.org/x264
cd x264
PKG_CONFIG_PATH="/opt/ffmpeg/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/opt/ffmpeg/ffmpeg_build" --bindir="/opt/ffmpeg/bin" --enable-static
make
make install
make distclean
cd /opt/ffmpeg/ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
cd /opt/ffmpeg/ffmpeg_sources/x265/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/opt/ffmpeg/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make
make install
cd /opt/ffmpeg/ffmpeg_sources
git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="/opt/ffmpeg/ffmpeg_build" --disable-shared
make
make install
make distclean
cd /opt/ffmpeg/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="/opt/ffmpeg/ffmpeg_build" --bindir="/opt/ffmpeg/bin" --disable-shared --enable-nasm
make
make install
make distclean
cd /opt/ffmpeg/ffmpeg_sources
git clone git://git.opus-codec.org/opus.git
cd opus
autoreconf -fiv
./configure --prefix="/opt/ffmpeg/ffmpeg_build" --disable-shared
make
make install
make distclean
cd /opt/ffmpeg/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="/opt/ffmpeg/ffmpeg_build" --disable-shared
make
make install
make distclean
cd /opt/ffmpeg/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
tar xzvf libvorbis-1.3.4.tar.gz
cd libvorbis-1.3.4
LDFLAGS="-L/opt/ffmpeg/ffmeg_build/lib" CPPFLAGS="-I/opt/ffmpeg/ffmpeg_build/include" ./configure --prefix="/opt/ffmpeg/ffmpeg_build" --with-ogg="/opt/ffmpeg/ffmpeg_build" --disable-shared
make
make install
make distclean
cd /opt/ffmpeg/ffmpeg_sources
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
cd libvpx
./configure --prefix="/opt/ffmpeg/ffmpeg_build" --disable-examples
make
make install
make clean
cd /opt/ffmpeg/ffmpeg_sources
git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
PKG_CONFIG_PATH="/opt/ffmpeg/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/opt/ffmpeg/ffmpeg_build" --extra-cflags="-I/opt/ffmpeg/ffmpeg_build/include" --extra-ldflags="-L/opt/ffmpeg/ffmpeg_build/lib" --bindir="/opt/ffmpeg/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
make
make install
make distclean
hash -r
ln -s /opt/ffmpeg/bin/ffmpeg /usr/local/bin/ffmpeg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment