Skip to content

Instantly share code, notes, and snippets.

@patmandenver
Created July 2, 2015 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patmandenver/c4b43fd560a47689ac34 to your computer and use it in GitHub Desktop.
Save patmandenver/c4b43fd560a47689ac34 to your computer and use it in GitHub Desktop.
ffmpeg install script for Ubuntu 14.04
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run with admin privileges 'sudo'"
echo "exiting...."
exit 1
fi
echo "*********************************"
echo "Installing ffmpeg on Ubuntu 14.04"
echo "*********************************"
echo "*********************************"
echo "1/12 Update apt-get"
echo "*********************************"
apt-get -y upgrade
apt-get -y update
echo "2/12 install needed build tools"
sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texi2html zlib1g-dev
echo "*********************************"
echo "3/12 Create location to do work in"
echo "*********************************"
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
echo "*********************************"
echo "4/12 Install yasm via apt-get"
echo "*********************************"
sudo apt-get -y install yasm
echo "*********************************"
echo "5/12 Install libx264 via apt-get"
echo "*********************************"
apt-get -y install libx264-dev
echo "*********************************"
echo "6/12 Install libx265 via build tools"
echo "*********************************"
sudo apt-get -y install cmake mercurial
cd ~/ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
cd ~/ffmpeg_sources/x265/build/linux
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make
make install
echo "*********************************"
echo "7/12 Install libfdk-acc via build tools"
echo "*********************************"
cd ~/ffmpeg_sources
wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master
tar xzvf fdk-aac.tar.gz
cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
echo "*********************************"
echo "8/12 Install libmp3lame via apt-get"
echo "*********************************"
apt-get -y install libmp3lame-dev
echo "*********************************"
echo "9/12 Install libopus via apt-get"
echo "*********************************"
apt-get -y install libopus-dev
echo "*********************************"
echo "10/12 Install libvpx build from source"
echo "*********************************"
cd ~/ffmpeg_sources
wget http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2
tar xjvf libvpx-v1.3.0.tar.bz2
cd libvpx-v1.3.0
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests
PATH="$HOME/bin:$PATH" make
make install
make clean
echo "*********************************"
echo "11/12 Install ffmpeg build from source"
echo "*********************************"
cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree
PATH="$HOME/bin:$PATH" make
make install
make distclean
hash -r
echo "*********************************"
echo "12/12 Moving ffmpeg tool from ~/bin to /bin"
echo "*********************************"
mv ~/bin/ff* /bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment