Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile FFmpeg with libfdk_aac

I been reading on how to convert mp3 to m4a, and found that I must compile FFmpeg if I'll use the AAC encoder, libfdk_aac.

But reading FFmpeg guide on how to compile FFmpeg with libfdk_aac makes no sense for a beginner like me.

To use libfdk_aac the encoding guide says:

Requires ffmpeg to be configured with --enable-libfdk_aac --enable-nonfree.

Where do I put those flags?

Do I put it here somewhere?:

cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean

Or maybe here somewhere?

cd ~/ffmpeg_sources
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
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-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx \
  --enable-libx264 --enable-nonfree --enable-x11grab
make
make install
make distclean
hash -r

If I'm reading the compile guide right I guess that these two chunks of code is what I need to compile FFmpeg.

I'm using Ubuntu server 12.4

UPDATE

After upgrading my system to Ubuntu 16.04 I had to install ffmpeg again. I still needed libfdk-aac. Fortunately there's a good step-by-step guide at http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu on how to compile ffmpeg.

I thought I would share how to compile if just interested in compiling ffmpeg with libfdk-aac and libmp3lame.

If you haven't already a bin in home directory:

mkdir ~/bin 

Install dependencies. Didn't need the non-server packages:

sudo apt-get update
sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libtheora-dev libtool libvorbis-dev pkg-config texinfo zlib1g-dev 

Then install the encoders. Had to install yasm as well, otherwise I got errors when compiling.

sudo apt-get install libfdk-aac-dev
sudo apt-get install libmp3lame-dev
sudo apt-get install yasm

Then compile ffmpeg with needed flags

cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--bindir="$HOME/bin" \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libtheora \
--enable-libvorbis \
--enable-libmp3lame \
--enable-nonfree \
--enable-gpl
PATH="$HOME/bin:$PATH" make
make install
make distclean
hash -r
like image 377
Toydor Avatar asked Sep 11 '13 16:09

Toydor


1 Answers

Requires ffmpeg to be configured with --enable-libfdk_aac --enable-nonfree.

These instructions are referring to the ffmpeg configure, not fdk-aac configure. In addition to the FFmpeg and AAC Encoding guide, I assume you are also following the Compile FFmpeg on Ubuntu, Debian, or Mint guide. This guide already includes everything you need to gain support for libfdk_aac in ffmpeg because --enable-libfdk_aac and --enable-nonfree are already present in the ./configure line for ffmpeg.

All you need to do is successfully copy and paste each code box.

like image 176
llogan Avatar answered Nov 17 '22 02:11

llogan