Skip to content

Instantly share code, notes, and snippets.

@jobevers
Last active September 30, 2018 09:37
Show Gist options
  • Save jobevers/8d459b7c6afae27fdad9c26d5b64fff8 to your computer and use it in GitHub Desktop.
Save jobevers/8d459b7c6afae27fdad9c26d5b64fff8 to your computer and use it in GitHub Desktop.
Compiling ffmpeg 2.8.7 from source on Ubuntu

Compilation instructions for ffmpeg-2.8.7

Compiled on 2016-05-25

Reference: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

Libraries/binaries to be compiled:

  • yasm-1.3.0 (already compiled from last time I built ffmpeg)
  • x264-snapshot-20160526-2245
  • libx265-4723933fdec9
  • libfdk-aac-15b128d
  • lame-3.99.5 (already compiled from last time I built ffmpeg)
  • opus-1.1.2
  • libvpx-v1.5.0

Instructions

sudo apt-get update
sudo apt-get -y 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 texinfo zlib1g-dev

export SOURCES=$HOME/ffmpeg_sources/ffmpeg-2.8
export APPS=$HOME/local/apps

cd $SOURCES
wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xf last_x264.tar.bz2 
cd x264-snapshot-20160526-2245/
mkdir $APPS/x264-snapshot-20160526-2245
./configure --prefix=$APPS/x264-snapshot-20160526-2245/ --enable-static
make
make install
make clean

cd $SOURCES
hg clone https://bitbucket.org/multicoreware/x265
cd x265/build/linux/
hg log | head -n 1
# An automatic way to get a version/changeset here would be nice
mkdir $APPS/libx265-4723933fdec9
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$APPS/libx265-4723933fdec9" -DENABLE_SHARED:bool=off ../../source
make install
make distclean

cd $SOURCES
wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master
tar xf fdk-aac.tar.gz
cd mstorsjo-fdk-aac*
autoreconf -fiv
mkdir $APPS/libfdk-aac-15b128d 
./configure --prefix=$APPS/libfdk-aac-15b128d/ --disable-shared
make
make install
make distclean

cd $SOURCES
wget http://downloads.xiph.org/releases/opus/opus-1.1.2.tar.gz
tar xf opus-1.1.2.tar.gz 
cd opus-1.1.2/
mkdir $APPS/opus-1.1.2
./configure --prefix=$APPS/opus-1.1.2/ --disable-shared
make
make install
make clean

cd $SOURCES
wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.5.0.tar.bz2
tar xf libvpx-1.5.0.tar.bz2 
cd libvpx-1.5.0/
mkdir $APPS/libvpx-v1.5.0/
./configure --prefix=$APPS/libvpx-v1.5.0/ --disable-examples --disable-unit-tests
make
make install
make clean

cd $SOURCES
tar xf ffmpeg-2.8.7.tar.bz2
cd ffmpeg-2.8.7/
mkdir $APPS/ffmpeg-2.8.7

export PKG_CONFIG_PATH=$APPS/opus-1.1.2/lib/pkgconfig:$APPS/libfdk-aac-15b128d/lib/pkgconfig:$APPS/opus-1.1/lib/pkgconfig:$APPS/libvpx-v1.5.0/lib/pkgconfig:$APPS/x264-snapshot-20160526-2245/lib/pkgconfig:$APPS/libx265-4723933fdec9/lib/pkgconfig 

./configure \
    --prefix="$APPS/ffmpeg-2.8.7" \
    --pkg-config-flags="--static" \
    --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 \
    --extra-cflags="-I$APPS/lame-3.99.5/include -I$APPS/x264-snapshot-20160526-2245/include" \
    --extra-ldflags="-L$APPS/lame-3.99.5/lib -L$APPS/x264-snapshot-20160526-2245/lib"

make
make install
$APPS/ffmpeg-2.8.7/bin/ffmpeg -version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment