User Tools

Site Tools


user:smeas:portfolio:hpc2project2

This is an old revision of the document!


Building ffmpeg on Ubuntu

ffmpeg is an incredibly versatile and handy tool for working with media files. Unfortunately, the Ubuntu repository no longer tracks changes to ffmpeg.

Objectives

Obtain the ffmpeg sources, and build a current version on an Ubuntu server.

Background

ffmpeg is a great tool, but, a little while ago, Ubuntu switched to avconv, a fork of ffmpeg. Unfortunately, avconv really isn't as good as ffmpeg. As such, the ffmpeg version with Ubuntu is pretty deprecated, and a lot of things don't work right.

Scope

This project will walk through the setup and compilation of the most recent ffmpeg version.

Procedure

Step 1

Getting the required dependencies

There are a few dependencies for ffmpeg that should be updated before we move onto compilation. First, update your repository.

sudo apt-get update

Next, we'll install the dependencies.

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 libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev

Finally, we'll install yasm, an assembler which will optimize the build time.

sudo apt-get install yasm

Step 2

Getting the sources

Now, we need to get the sources for ffmpeg. First, make a directory in your home directory titled ffmpeg_sources

mkdir ~/ffmpeg_sources

There are a few encoder dependencies that need to be gotten and built for ffmpeg. First, the H.264 video codec.

cd ~/ffmpeg_sources
wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjvf last_x264.tar.bz2
cd x264-snapshot*
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
make distclean

Next, we need the AAC audio encoder.

cd ~/ffmpeg_sources
wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
unzip fdk-aac.zip
cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean

Next, the MP3 audio codec.

sudo apt-get install libmp3lame-dev

Now, we'll get the sources for ffmpeg and compile them.

cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"
export PKG_CONFIG_PATH
./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/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
user/smeas/portfolio/hpc2project2.1399403764.txt.gz · Last modified: 2014/05/06 19:16 by smeas