Last active
January 20, 2018 15:04
-
-
Save loinguyenduc101/d9a92b559d872ee96d1989f8e4700d99 to your computer and use it in GitHub Desktop.
ffmpeg 3.3.6 install on CentOS 6
This file contains hidden or 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
#! /bin/sh | |
#set -e | |
#to remove trailing \r character | |
#sed -i 's/\r$//' file_name.sh or using dos2unix to format: sudo yum install dos2unix -y | |
#https://trac.ffmpeg.org/wiki/CompilationGuide/Centos | |
#https://abi-laboratory.pro/tracker/timeline/ffmpeg/ | |
FFMPEG_HOME=/opt/ffmpeg | |
FFMPEG_VERSION=3.3.6 | |
exec_time=$(date +"%Y%m%d%H%M%S"); | |
echo "=======================================> install required packages for ffmpeg $FFMPEG_VERSION" | |
yum -y install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel | |
yum -y install freetype-devel speex-devel | |
yum -y install wget git hg | |
echo "=======================================> backup " | |
test -e $FFMPEG_HOME/ffmpeg_sources && mv -f $FFMPEG_HOME/ffmpeg_sources $FFMPEG_HOME/ffmpeg_sources_$exec_time | |
test -e $FFMPEG_HOME/ffmpeg_build && mv -f $FFMPEG_HOME/ffmpeg_build $FFMPEG_HOME/ffmpeg_build_$exec_time | |
test -e $FFMPEG_HOME/bin && mv -f $FFMPEG_HOME/bin $FFMPEG_HOME/bin_$exec_time | |
test -e /etc/profile.d/ffmpeg.sh && mv -f /etc/profile.d/ffmpeg.sh /etc/profile.d/ffmpeg.sh_$exec_time | |
echo "=======================================> install ffmpeg module" | |
echo "=======================================> make FFMPEG_HOME" | |
mkdir -p $FFMPEG_HOME | |
mkdir -p $FFMPEG_HOME/ffmpeg_sources | |
mkdir -p $FFMPEG_HOME/bin | |
#add to PATH | |
PATH="$FFMPEG_HOME/bin:$PATH" | |
echo "=======================================> NASM" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 | |
tar xjf nasm-2.13.02.tar.bz2 | |
cd nasm-2.13.02 | |
./autogen.sh | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --bindir="$FFMPEG_HOME/bin" | |
make -s | |
make install | |
echo "=======================================> Yasm" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz | |
tar xzf yasm-1.3.0.tar.gz | |
cd yasm-1.3.0 | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --bindir="$FFMPEG_HOME/bin" | |
make -s | |
make install | |
echo "=======================================> libx264" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
git clone --depth 1 http://git.videolan.org/git/x264 | |
cd x264 | |
PKG_CONFIG_PATH="$FFMPEG_HOME/ffmpeg_build/lib/pkgconfig" | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --bindir="$FFMPEG_HOME/bin" --enable-static | |
make -s | |
make install | |
echo "=======================================> libx265" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
hg clone https://bitbucket.org/multicoreware/x265 | |
cd x265/build/linux | |
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$FFMPEG_HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source | |
make -s | |
make install | |
#export nasm to PATH | |
PATH="$FFMPEG_HOME/bin:$PATH" | |
echo "=======================================> libfdk_aac" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
git clone --depth 1 https://github.com/mstorsjo/fdk-aac | |
cd fdk-aac | |
autoreconf -fiv | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --disable-shared | |
make -s | |
make install | |
echo "=======================================> libmp3lame" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
wget http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz | |
tar xzf lame-3.100.tar.gz | |
cd lame-3.100 | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --bindir="$FFMPEG_HOME/bin" --disable-shared --enable-nasm | |
make -s | |
make install | |
echo "=======================================> libopus" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
wget https://archive.mozilla.org/pub/opus/opus-1.2.1.tar.gz | |
tar xzf opus-1.2.1.tar.gz | |
cd opus-1.2.1 | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --disable-shared | |
make -s | |
make install | |
echo "=======================================> libogg" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.gz | |
tar xzf libogg-1.3.3.tar.gz | |
cd libogg-1.3.3 | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --disable-shared | |
make -s | |
make install | |
echo "=======================================> libvorbis" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz | |
tar xzf libvorbis-1.3.5.tar.gz | |
cd libvorbis-1.3.5 | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --with-ogg="$FFMPEG_HOME/ffmpeg_build" --disable-shared | |
make -s | |
make install | |
echo "=======================================> libtheora" | |
#option | |
cd $FFMPEG_HOME/ffmpeg_sources | |
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz | |
tar xzf libtheora-1.1.1.tar.gz | |
cd libtheora-1.1.1 | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --with-ogg="$FFMPEG_HOME/ffmpeg_build" --disable-examples --disable-shared --disable-sdltest --disable-vorbistest | |
make -s | |
make install | |
echo "=======================================> libvpx" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git | |
cd libvpx | |
./configure --prefix="$FFMPEG_HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm | |
#PATH="$FFMPEG_HOME/bin:$PATH" | |
make -s | |
make install | |
echo "=======================================> ffmpeg-$FFMPEG_VERSION" | |
cd $FFMPEG_HOME/ffmpeg_sources | |
wget https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 | |
tar xjf ffmpeg-$FFMPEG_VERSION.tar.bz2 | |
cd ffmpeg-$FFMPEG_VERSION | |
PATH="$FFMPEG_HOME/bin:$PATH" PKG_CONFIG_PATH="$FFMPEG_HOME/ffmpeg_build/lib/pkgconfig" ./configure \ | |
--prefix="$FFMPEG_HOME/ffmpeg_build" \ | |
--pkg-config-flags="--static" \ | |
--extra-cflags="-I$FFMPEG_HOME/ffmpeg_build/include" \ | |
--extra-ldflags="-L$FFMPEG_HOME/ffmpeg_build/lib" \ | |
--extra-libs=-lpthread \ | |
--extra-libs=-lm \ | |
--bindir="$FFMPEG_HOME/bin" \ | |
--enable-gpl \ | |
--enable-libfdk_aac \ | |
--enable-libfreetype \ | |
--enable-libmp3lame \ | |
--enable-libopus \ | |
--enable-libvorbis \ | |
--enable-libvpx \ | |
--enable-libx264 \ | |
--enable-libx265 \ | |
--enable-nonfree | |
make -s | |
make install | |
hash -r | |
echo "=======================================> make FFMPEG_HOME" | |
tee /etc/profile.d/ffmpeg.sh <<'END' | |
export FFMPEG_HOME=/opt/ffmpeg | |
export PATH=${FFMPEG_HOME}/bin:${PATH} | |
END | |
# apply changes | |
source /etc/profile.d/ffmpeg.sh | |
# test maven home | |
echo "Finished, path installed $FFMPEG_HOME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment