-
-
Save zenny/e07196eaa867e4a44279 to your computer and use it in GitHub Desktop.
Simple Bash Script to Install FFMPEG + Required Libraries in Ubuntu 14.04
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
#!/bin/bash | |
# Bash Script to Install FFMPEG in Ubuntu 14.04 | |
# Ref: http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu | |
# Opsional: install exiftool: apt-get install libimage-exiftool-perl | |
# | |
# Author: Edi Septriyanto http://masedi.net <[email protected]> | |
######################################################################## | |
CURDIR=$(pwd) | |
echo "Install Pre-requisites libraries..." | |
sleep 3 | |
sudo apt-get update | |
sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \ | |
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libx11-dev \ | |
libxext-dev libxfixes-dev libimage-exiftool-perl pkg-config texi2html zlib1g-dev git | |
mkdir $CURDIR/ffmpeg_sources | |
mkdir $CURDIR/ffmpeg_build | |
## Yasm | |
clear | |
echo "Install Yasm library..." | |
sleep 3 | |
#sudo apt-get install yasm | |
cd $CURDIR/ffmpeg_sources | |
if [ ! -d yasm ]; then | |
git clone https://github.com/yasm/yasm.git yasm | |
fi | |
cd yasm | |
autoreconf -fiv | |
./configure --prefix="$CURDIR/ffmpeg_build" --bindir="/usr/local/bin" | |
make | |
make install | |
ldconfig | |
make distclean | |
export "PATH=$PATH:/usr/local/bin" | |
## libx264 - H.264 video encoder | |
clear | |
echo "Install libx264 - H.264 video encoder library..." | |
sleep 3 | |
cd $CURDIR/ffmpeg_sources | |
#wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2 | |
if [ ! -d x264 ]; then | |
git clone http://git.videolan.org/git/x264.git x264 | |
fi | |
cd x264 | |
./configure --prefix="$CURDIR/ffmpeg_build" --bindir="/usr/local/bin" --enable-static | |
make | |
make install | |
ldconfig | |
make distclean | |
## libfdk-aac - AAC audio encoder | |
clear | |
echo "Install libfdk-aac - AAC audio encoder library..." | |
sleep 3 | |
cd $CURDIR/ffmpeg_sources | |
#wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master | |
if [ ! -d fdk-aac ]; then | |
git clone https://github.com/mstorsjo/fdk-aac.git fdk-aac | |
fi | |
cd fdk-aac | |
autoreconf -fiv | |
./configure --prefix="$CURDIR/ffmpeg_build" --disable-shared | |
make | |
make install | |
ldconfig | |
make distclean | |
## libmp3lame - MP3 audio encoder | |
clear | |
echo "Install libmp3lame - MP3 audio encoder library..." | |
sleep 3 | |
sudo apt-get install -y libmp3lame-dev | |
#sudo apt-get install nasm | |
#cd $CURDIR/ffmpeg_sources | |
#if [ ! -d lame-3.995.5 ]; then | |
# wget http://sourceforge.net/projects/lame/files/latest/download -O libmp3lame.tar.gz | |
# tar zxf libmp3lame.tar.gz | |
#fi | |
#cd lame-3.995.5 | |
#./configure --prefix="$CURDIR/ffmpeg_build" --enable-nasm --disable-shared | |
#make | |
#make install | |
#make distclean | |
## libopus - Opus audio decoder and encoder | |
clear | |
echo "Install libopus - Opus audio decoder and encoder library..." | |
sleep 3 | |
#sudo apt-get install libopus-dev | |
cd $CURDIR/ffmpeg_sources | |
if [ ! -d libopus ]; then | |
git clone git://git.opus-codec.org/opus.git libopus | |
fi | |
cd libopus | |
./autogen.sh | |
./configure --prefix="$CURDIR/ffmpeg_build" --enable-static --enable-shared | |
make | |
make install | |
ldconfig | |
make distclean | |
## libvorbis | |
clear | |
echo "Install libvorbis - Standard audio encoder and decoder library..." | |
sleep 3 | |
sudo apt-get install -y libvorbis-dev | |
## libvpx - VP8/VP9 video encoder and decoder | |
clear | |
echo "Install libvpx - VP8/VP9 video encoder and decoder library..." | |
sleep 3 | |
cd $CURDIR/ffmpeg_sources | |
if [ ! -d libvpx ]; then | |
git clone https://chromium.googlesource.com/webm/libvpx libvpx | |
fi | |
cd libvpx | |
./configure --prefix="$CURDIR/ffmpeg_build" --disable-examples | |
make | |
make install | |
make clean | |
## ffmpeg | |
clear | |
echo "Install FFMPeg..." | |
sleep 3 | |
cd $CURDIR/ffmpeg_sources | |
if [ ! -d ffmpeg ]; then | |
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg | |
fi | |
cd ffmpeg | |
PKG_CONFIG_PATH="$CURDIR/ffmpeg_build/lib/pkgconfig" | |
export PKG_CONFIG_PATH | |
./configure --prefix="$CURDIR/ffmpeg_build" --extra-cflags="-I$CURDIR/ffmpeg_build/include" \ | |
--extra-ldflags="-L$CURDIR/ffmpeg_build/lib" --bindir="/usr/local/bin" --extra-libs="-ldl" --enable-gpl \ | |
--enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus \ | |
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab | |
make | |
make install | |
make distclean | |
hash -r | |
## Updating ffmpeg | |
#rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,vsyasm,x264,yasm,ytasm} | |
## Reverting Changes Made by This Guide | |
#rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,vsyasm,x264,yasm,ytasm} | |
#sudo apt-get autoremove autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \ | |
# libmp3lame-dev libopus-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \ | |
# libvorbis-dev libvpx-dev libx11-dev libxext-dev libxfixes-dev texi2html zlib1g-dev | |
#sed -i '/ffmpeg_build/c\' ~/.manpath | |
#hash -r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment