Skip to content

Instantly share code, notes, and snippets.

@patmandenver
Created July 4, 2015 20:32
Show Gist options
  • Save patmandenver/14590573545260163e3d to your computer and use it in GitHub Desktop.
Save patmandenver/14590573545260163e3d 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 "*"
echo "* Installing ffmpeg on Ubuntu 14.04"
echo "*"
echo "*********************************"
echo "*********************************"
echo "*"
echo "* 1/13 Update apt-get"
echo "*"
echo "*********************************"
apt-get -y upgrade
apt-get -y update
echo "*********************************"
echo "*"
echo "* 2/13 install needed build tools"
echo "*"
echo "*********************************"
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 \
cmake \
mercurial
echo "*********************************"
echo "*"
echo "* 3/13 Set PATH/PKG_CONFIG_PATH"
echo "*"
echo "*********************************"
export PATH="$HOME/bin:$PATH"
export PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"
echo "*********************************"
echo "*"
echo "* 4/13 Create location to do work in"
echo "*"
echo "*********************************"
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
echo "*********************************"
echo "*"
echo "* 5/13 Install yasm via apt-get"
echo "*"
echo "*********************************"
apt-get -y install yasm
echo "*********************************"
echo "*"
echo "* 6/13 Install libx264 via apt-get"
echo "*"
echo "*********************************"
apt-get -y install libx264-dev
echo "*********************************"
echo "*"
echo "* 7/13 Install libx265 via build tools"
echo "*"
echo "*********************************"
cd ~/ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
cd ~/ffmpeg_sources/x265/build/linux
cmake -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" \
-DENABLE_SHARED:bool=off ../../source
make
make install
echo "*********************************"
echo "*"
echo "* 8/13 Install libfdk-acc via build tools"
echo "*"
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 "*"
echo "* 9/13 Install libmp3lame via apt-get"
echo "*"
echo "*********************************"
apt-get -y install libmp3lame-dev
echo "*********************************"
echo "*"
echo "* 10/13 Install libopus via apt-get"
echo "*"
echo "*********************************"
apt-get -y install libopus-dev
echo "*********************************"
echo "*"
echo "* 11/13 Install libvpx build from source"
echo "*"
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
./configure --prefix="$HOME/ffmpeg_build" \
--disable-examples \
--disable-unit-tests
make
make install
make clean
echo "*********************************"
echo "*"
echo "* 12/13 Install ffmpeg build from source"
echo "*"
echo "*********************************"
cd ~/ffmpeg_sources
wget \
http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
./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
make
make install
make distclean
hash -r
echo "*********************************"
echo "*"
echo "* 13/13 Moving ffmpeg tool from ~/bin to /bin"
echo "*"
echo "*********************************"
mv ~/bin/ff* /bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment