-
-
Save gh0stwizard/5f2d61346d9c9c8de28a47926cb0b0fe to your computer and use it in GitHub Desktop.
Installs latest ffmpeg on Centos 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide | |
# yum install -y autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel freetype-devel speex-devel | |
dldir=$HOME/ffmpeg_sources | |
prefix=$HOME/ffmpeg_build | |
bindir=$HOME/bin | |
CURL="curl -L -C - -O" | |
[[ ! -e ${dldir} ]] && (mkdir -p ${dldir} || exit 1) | |
function build() { | |
name=$1 | |
tar="" | |
ac="" | |
usage='usage: build nasm|yasm|x264|fdk-aac' | |
case "$name" in | |
'') | |
echo "${usage}" | |
return 1;; | |
nasm) | |
dir=nasm-2.13.01 | |
tar="tar xJvf $dir.tar.xz" | |
dl="${CURL} http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/$dir.tar.xz" | |
cf="./configure --prefix=${prefix} --bindir=${bindir}" | |
;; | |
yasm) | |
dir=yasm-1.2.0 | |
tar="tar xzvf $dir.tar.gz" | |
dl="${CURL} http://www.tortall.net/projects/yasm/releases/$dir.tar.gz" | |
cf="./configure --prefix=${prefix} --bindir=${bindir}" | |
;; | |
x264) | |
dir=$name | |
dl="git clone --depth 1 git://git.videolan.org/x264" | |
cf="./configure --prefix=${prefix} --bindir=${bindir} --enable-static" | |
;; | |
fdk-aac) | |
dir=$name | |
dl="git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git" | |
ac="autoreconf -fiv" | |
cf="./configure --prefix=${prefix} --disable-shared" | |
;; | |
lame) | |
dir=lame-3.99.5 | |
tar="tar xzvf $dir.tar.gz" | |
dl="${CURL} http://downloads.sourceforge.net/project/lame/lame/3.99/$dir.tar.gz" | |
cf="./configure --prefix=${prefix} --bindir=${bindir} --disable-shared --enable-nasm" | |
;; | |
opus) | |
dir=opus-1.2.1 | |
tar="tar xzvf $dir.tar.gz" | |
dl="${CURL} https://archive.mozilla.org/pub/opus/$dir.tar.gz" | |
cf="./configure --prefix=${prefix} --disable-shared" | |
;; | |
ogg) | |
dir=libogg-1.3.1 | |
tar="tar xzvf $dir.tar.gz" | |
dl="${CURL} http://downloads.xiph.org/releases/ogg/$dir.tar.gz" | |
cf="./configure --prefix="${prefix}" --disable-shared" | |
;; | |
vorbis) | |
dir=libvorbis-1.3.3 | |
tar="tar xzvf $dir.tar.gz" | |
dl="${CURL} http://downloads.xiph.org/releases/vorbis/$dir.tar.gz" | |
cf="./configure --prefix=${prefix} --with-ogg=${prefix} --disable-shared" | |
;; | |
vpx) | |
dir=libvpx | |
dl="git clone --depth 1 https://chromium.googlesource.com/webm/libvpx" | |
cf="./configure --prefix=${prefix} --disable-examples --disable-unit-tests" | |
;; | |
theora) | |
dir=libtheora-1.1.1 | |
tar="tar xzvf $dir.tar.gz" | |
dl="${CURL} http://downloads.xiph.org/releases/theora/$dir.tar.gz" | |
cf="./configure --prefix=${prefix} --with-ogg=${prefix} --disable-examples --disable-shared --disable-sdltest --disable-vorbistest" | |
;; | |
ffmpeg) | |
dir=$name | |
dl="git clone --depth 1 git://source.ffmpeg.org/ffmpeg" | |
cf="./configure --prefix=${prefix} --extra-cflags=-I${prefix}/include --extra-ldflags=-L${prefix}/lib --bindir=${bindir} --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" | |
;; | |
*) | |
echo "${usage}" | |
return 1;; | |
esac | |
echo "--------------------------------" | |
echo $name | |
echo "--------------------------------" | |
cd ${dldir} || return 1 | |
if [[ -e $dir ]]; then | |
echo ">>> SKIP $dir" | |
return 0 | |
fi | |
$dl || return 1 | |
[[ ${tar} == "" ]] || ${tar} || return 1 | |
cd $dir || return 1 | |
# autoconf | |
[[ ${ac} == "" ]] || ${ac} || return 1 | |
${cf} || return 1 | |
make && make install || return 1 | |
return 0 | |
} | |
PATH=$bindir:$PATH | |
export PATH | |
PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" | |
export PKG_CONFIG_PATH | |
build nasm || exit 1 | |
build yasm || exit 1 | |
. $HOME/.bash_profile | |
build x264 || exit 1 | |
build fdk-aac || exit 1 | |
build lame || exit 1 | |
build opus || exit 1 | |
build ogg || exit 1 | |
build vorbis || exit 1 | |
build vpx || exit 1 | |
build theora || exit 1 | |
build ffmpeg || exit 1 | |
hash -r | |
. $HOME/.bash_profile | |
#cd ~/ffmpeg_sources/ffmpeg/tools | |
#make qt-faststart | |
##cp qt-faststart /usr/bin | |
#ldconfig | |
#cd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment