Ubuntu – How to install avconv with libfdk_aac on Ubuntu 14.04

aacavconvffmpeg

How to install or compile avconv with libfdk_aac on Ubuntu 14.04 ? I am also ok with comparable aac codecs e.g. http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC

Currently I am trying this but with avconv: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

I let you know how it works out.

Best Answer

Here's how I do it. But I must warn you, this requires a little courage as you must build libav (This will give you the avconv executable among other tools) yourself. But have no fear, I have done it many times and I'll show you how to to build and install everything without messing your system up. If you don't want your custom libav build anymore, all you have to do is delete a directory.

Prerequisites

First I remove the avconv installed buy default with:

apt-get remove --purge libav-tools

Then make sure you have the required tools for building software in general:

apt-get install build-essential

To get the fastest avconv possible you'll need an assembly compiler. That's easy:

apt-get install yasm

Now get into a scrap directory to build in, I'll do:

mkdir ~/src
cd ~/src

Now clone the libav git repo (you'll need git installed for this):

git clone git://git.libav.org/libav.git

This will give you the the latest and greatest libav source, I have found the bleeding edge code stable enough for my needs and haven't run into any code related bugs during building.

Let the repo clone and then install libfdk-aac through the package manager:

apt-get install libfdk-aac-dev

To make things simple lets just install the libx264 library for avconv to use:

apt-get install libx264-dev

Create a home for the binaries and other files that will be built in a moment (This will make things easy to uninstall as well):

mkdir ~/apps    

Once installed, the avconv executable will be located in ~/apps/bin/ To run avconv from the command line simply add ~/apps/bin to you $PATH

Installation

Now you, need to configure the libav source to use your newly install fdk-aac library. Simply enter this in the command line:

./configure \
--prefix=~/apps \
--enable-nonfree \
--enable-gpl \
--disable-shared \
--enable-static \
--enable-libx264 \
--enable-libfdk-aac

This command will give you all of libav default encoding and decoding libraries plus libx264 and libfdk_aac Note: should you want more encoding functionality try ./configure --help to see all the external libraries you can enable.

Now all thats left to do is build the thing! This should only take a few minutes on a decent machine.

make && make install

If you added ~/apps/bin to you $PATH you should be able to run 'avconv' now.

To update your custom libav build, just run:

git pull origin

In ~/src/libav/ up pull the latest code. Then reconifgure with the command above, make and make install.

Should you every want to get rid of you custom build and reinstall ubuntu's default libav-tools packages run:

rm -rf ~/apps/
apt-get install libav-tools

And remove ~/apps/bin from your $PATH

Sorry if the task you want to achieve seems daunting, but it makes me proud to use a custom built, bleeding edge version of avconv :) I think the extra work pays off. Hope this helps :)

Verification

Verify it is installed correctly with:

avconv -codecs | grep aac

You want to see:

AAC (Advanced Audio Coding) (decoders: aac libfdk_aac ) (encoders: aac libfdk_aac )

Usage

avconv -f alsa -i default -c:a libfdk_aac -b:a 256k filename.aac

Please note that the infamous experimental flag is now not necessary nor recommended anymore.

You want to see:

  Metadata:
  encoder         : Lavc58.12.1 libfdk_aac