Je suis développeur et consultant sur des projets informatiques dans ma société, Phonoid. Avec mes amis, nous y développons des solutions sur mesure pour nos super clients. Nous travaillons également sur nos futurs produits.
Lately, I've been doing a lot of ffmpeg tasks for one of my patners in the music business. We are using that software to generate videos for Youtube.
The recommended sound settings for a Youtube upload is :
MPEG AAC Audio (mp4a) 48kHz
and the standard of the industry for WAV files is :
PCM 44.1 kHz 16 bits
So when generating our videos, we need to encode our PCM input stream to AAC.
ffmpeg ships with a built-in AAC codec but it does not work perfectly. So we decided to use libfdk-aac instead. That library isn't opensource so you have to build ffmpeg against it manually in order to use it. Yey, I love compiling and linking stuff :-/
I followed the official compilation guide for Ubuntu but I had some issues. That's why I wrote this article : I don't want to search for a solution a second time !
Install base packages
sudo apt-get update
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 unzip
mkdir ~/ffmpeg_sources
YASM
cd ~/ffmpeg_sources
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
libx264
cd ~/ffmpeg_sources
wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjvf last_x264.tar.bz2
cd x264-snapshot*
PATH="$PATH:$HOME/bin" ./configure \
--prefix="$HOME/ffmpeg_build" \
--bindir="$HOME/bin" \
--enable-static --disable-opencl
PATH="$PATH:$HOME/bin" make
make install
libfdk-aac
The official instructions say to download from https://github.com/mstorsjo/fdk-aac/zipball/master. But that version ain't compile with ffmpeg for me, for whatever fucking reason.
So I decided to use an older version.
cd ~/ffmpeg_sources
git clone https://github.com/mstorsjo/fdk-aac.git
cd fdk-aac*
git checkout v0.1.3
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
The key point here is the checkout of the v0.1.3 tag.
libmp3lame
sudo apt-get install nasm
cd ~/ffmpeg_sources
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared
make
make install
ffmpeg himself
cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$PATH:$HOME/bin" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--bindir="$HOME/bin" --enable-gpl --enable-libfdk-aac --enable-libfreetype \
--enable-libmp3lame --enable-libx264 --enable-nonfree
PATH="$PATH:$HOME/bin" make
make install
Some verifications
ffmpeg -codecs | grep AAC
ffmpeg -codecs | grep libx264
A symlink for convenience
sudo ln -s /home/ubuntu/bin/ffmpeg /usr/local/bin/ffmpeg
Done !
Easy. OK. I spent hours to get here. I hope it will help someone else.