12

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
Toydor
  • 2,277
  • 4
  • 30
  • 48

1 Answers1

7

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.

llogan
  • 121,796
  • 28
  • 232
  • 243
  • I'm trying to configure ffmpeg with --enable-nonfree and --enable-libfdk_aac like this: ./configure --enable-nonfree --enable-libfdk_aac but it gives me a warning saying that they're unrecognized options? –  Oct 26 '14 at 19:46
  • I followed this guide to install FFMPEG on a OS X http://jungels.net/articles/ffmpeg-howto.html I just realized that I grabbed the config.log from the LAME folder so I'm actually not sure where to find the one from FFMPEG? –  Oct 27 '14 at 18:39
  • @Luke That guide is terribly outdated. See [Compile FFmpeg on OS X](http://trac.ffmpeg.org/wiki/CompilationGuide/MacOSX). – llogan Oct 28 '14 at 05:27
  • ok here's the actual config.log for FFMPEG I figured out where I installed it — http://pastebin.com/4D5C37X3 –  Oct 28 '14 at 06:06
  • @Luke I see no obvious errors (but I don't know what I'm supposed to be looking for here), but it doesn't look like it came from the guide I linked to. – llogan Oct 28 '14 at 06:17
  • alright I installed FFMPEG following the guide you linked but I can't seem to find where it installed –  Oct 28 '14 at 07:39
  • Thank you it solved my problem of building ffmpeg as static binary. – User4283 Nov 28 '18 at 14:12