This tutorial is designed for a headless server, and does not install anything related to X11. These instructions assume that you have escalated to root (sudo su), and have been tested with Ubuntu 12.04, 12.10, & 13.04.

Initial Installation

  1. Remove old ffmpeg, x264, and avconv
    apt-get remove -y ffmpeg x264 libav-tools yasm &&
    apt-get autoremove -y
  2. Install dependencies. I added python-dev & cython because I use the yasm Python bindings; remove if you do not need them.
    apt-get update && apt-get upgrade -y &&
    apt-get install -y autoconf automake build-essential git libass-dev libfaac-dev libgpac-dev \
      libmp3lame-dev libopus-dev libtheora-dev libtool libvorbis-dev libvpx-dev pkg-config texi2html \
      zlib1g-dev python-dev cython
  3. Set up the sources directory
    cd /usr/local/src/ &&
    mkdir ffmpeg_sources &&
    cd ffmpeg_sources/
  4. Install yasm. The current version is 1.3.0 (as of 02/28/2015); check http://yasm.tortall.net/Download.html for new versions. Remove --enable-python-bindings if you do not need the yasm Python bindings.
    wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz &&
    tar -xvf yasm-1.3.0.tar.gz &&
    cd yasm-1.3.0 &&
    ./configure --prefix="/usr/local/src/ffmpeg_build" --bindir="/usr/local/bin" --enable-python-bindings &&
    make && make install && make distclean &&
    cd .. &&
    rm -Rf yasm-1.3.0.tar.gz
  5. Install x264
    git clone --depth 1 git://git.videolan.org/x264.git &&
    cd x264 &&
    ./configure --prefix="/usr/local/src/ffmpeg_build" --bindir="/usr/local/bin" --enable-static &&
    make && make install && make distclean &&
    cd ..
  6. Install fdk-aac
    git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git &&
    cd fdk-aac &&
    autoreconf -fiv &&
    ./configure --prefix="/usr/local/src/ffmpeg_build" --bindir="/usr/local/bin" --disable-shared &&
    make && make install && make distclean &&
    cd ..
  7. Install ffmpeg
    git clone --depth 1 git://source.ffmpeg.org/ffmpeg &&
    cd ffmpeg &&
    ./configure --prefix="/usr/local/src/ffmpeg_build" --extra-cflags="-I/usr/local/src/ffmpeg_build/include" \
      --extra-ldflags="-L/usr/local/src/ffmpeg_build/lib" --bindir="/usr/local/bin" --extra-libs="-ldl" --enable-gpl \
      --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-postproc \
      --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree &&
    make && make install && make distclean &&
    hash -r &&
    cd ..

Updating

  1. Remove old build files & binaries
    rm -Rf /usr/local/src/ffmpeg_build /usr/local/bin/{ffmpeg,ffplay,ffprobe,ffserver,yasm,vsyasm,ytasm,x264}
  2. Update packages through package manager
    apt-get update && apt-get upgrade -y
  3. Install yasm. The current version is 1.3.0 (as of 02/28/2015); check http://yasm.tortall.net/Download.html for new versions. Remove --enable-python-bindings if you do not need the yasm Python bindings.
    cd /usr/local/src/ffmpeg_sources &&
    wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz &&
    tar -xvf yasm-1.3.0.tar.gz &&
    cd yasm-1.3.0 &&
    ./configure --prefix="/usr/local/src/ffmpeg_build" --bindir="/usr/local/bin" --enable-python-bindings &&
    make && make install && make distclean &&
    cd .. &&
    rm -Rf yasm-1.3.0.tar.gz
  4. Update source binaries
    cd /usr/local/src/ffmpeg_sources/x264 &&
    git pull &&
    ./configure --prefix="/usr/local/src/ffmpeg_build" --bindir="/usr/local/bin" --enable-static &&
    make && make install && make distclean &&
    cd ../fdk-aac &&
    git pull  &&
    ./configure --prefix="/usr/local/src/ffmpeg_build" --disable-shared &&
    make && make install && make distclean &&
    cd ../ffmpeg &&
    ./configure --prefix="/usr/local/src/ffmpeg_build" --extra-cflags="-I/usr/local/src/ffmpeg_build/include" \
      --extra-ldflags="-L/usr/local/src/ffmpeg_build/lib" --bindir="/usr/local/bin" --extra-libs="-ldl" --enable-gpl \
      --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-postproc \
      --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree &&
    make && make install && make distclean &&
    cd ..
0