2 July 2007

How to install FFmpeg with MP3 and AMR support

Posted by Matthieu under: Linux; Tutorial

My web server runs debian but the FFmpeg debian package is not compiled with MP3 nor AMR support. So I had to get my hands dirty… good old fashion compilation of sources :)

If you want to use these instructions you will need to have a c compiler, subversion and all the decompressing tools (gzip, bzip2, tar) installed.

Get audio codecs (MP3 and AMR)


  1. Grab the latest sources from the MP3 LAME official site:
    e.g. lame-3.97.tar.gz
  2. Decompress the source code:
    gunzip lame-3.97.tar.gz
    tar xvf lame-3.97.tar
  3. Change directory:
    cd lame-3.97
  4. Configure and install:
    make install (as root or sudo)

AMR (NB & WB):

  1. Grab the AMR Codec Libraries (The FFmpeg documentation has a section about installing AMR):
    e.g. amrnb- and amrwb-
  2. Decompress sources:
    bunzip2 amrnb-
    tar xvf amrnb-
  3. Change directory:
    cd amrnb-
  4. Configure and install:
    make install (as root or sudo)
  5. Repeat same steps 2,3 and 4 for amrwb-

Make sure that that your /etc/ld.so.conf includes the directory where these 3 libraries just got installed (usually its /usr/local/lib). Mine didn’t so I had to add it:

  • create the file /etc/ld.so.conf.d/ffmpeg.conf
  • add the line /usr/local/lib
  • then run ldconfig


  1. We need to get FFmpeg from the subversion repository:
    svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
  2. Change directory:
    cd ffmpeg
  3. Configure and install:
    ./configure –enable-libamr_nb –enable-libamr_wb –enable-libmp3lame
    make install (as root or sudo)

After that you should be able to use FFmpeg to encode flv or 3gp etc… with sound.

20 Comments so far...

ebo Says:

15 September 2007 at 16:19.

I am a newbie and want to have ffmpeg on my site. Is there any way to do this without using the command prompt?

Spud Quibber Says:

21 October 2007 at 00:37.

Dude, you’re my hero, been at it for about 2 hours and your tutorial worked perfectly the first time.

Satyam Says:

2 November 2007 at 05:45.


I am getting problem during complilation.

/usr/local/wayzup/ffmpeg/libavcodec/libavcodec.a(libamr.o): In function `amr_nb_encode_init’:
/usr/local/wayzup/ffmpeg/libavcodec/libamr.c:408: undefined reference to `VADxEncoder_Interface_init’
/usr/local/wayzup/ffmpeg/libavcodec/libavcodec.a(libamr.o): In function `amr_nb_decode_frame’:
/usr/local/wayzup/ffmpeg/libavcodec/libamr.c:464: undefined reference to `GP3Decoder_Interface_Decode’
/usr/local/wayzup/ffmpeg/libavcodec/libavcodec.a(libamr.o): In function `amr_nb_encode_frame’:
/usr/local/wayzup/ffmpeg/libavcodec/libamr.c:482: undefined reference to `GP3VADxEncoder_Interface_Encode’
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1

Please me in this


thankalot Says:

7 November 2007 at 18:43.


agtest Says:

23 January 2008 at 01:49.

I am also getting the same error as Satyam says. Any idea how to fix this.
/home/dev3/public_html/vasanthi/ffmpeg/libavcodec/libavcodec.so: undefined reference to `GP3Decoder_Interface_Decode’
/home/dev3/public_html/vasanthi/ffmpeg/libavcodec/libavcodec.so: undefined reference to `VADxEncoder_Interface_init’
/home/dev3/public_html/vasanthi/ffmpeg/libavcodec/libavcodec.so: undefined reference to `GP3VADxEncoder_Interface_Encode’
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1

thanks Says:

16 March 2008 at 12:25.

Massive thanks! Works like a charm!

Two things I think I should mention, though:
1.) –enable-nonfree must also be specified on the configuration command line for ffmpeg. This is required for it to use amr.
2.) When using ffmpeg, one needs to specify libmp3lame instead of just mp3 for it to work. Other than that, same result.

Oh and on the people with undefined references, since ffmpeg is being downloaded from svn, you get the absolute bleeding edge version. This is bound to have errors. The solution is to just wait, or to download a stable tarball elsewhere.


RailsRoller Says:

1 April 2008 at 06:45.


for the ./configure parameters, is it:–enable-libamr_nb –enable-libamr_wb or ./configure –enable-libamr-nb –enable-libamr-wb ??

And is there any config to do to enable the amr support in mpeg4ip??


fiva Says:

8 April 2008 at 02:57.

./configure –help

laurent Says:

31 May 2008 at 12:41.


i tried this out, the installation seemed to work fine, but i still get no sound :S
os: fedora9

Thiago PC Says:

3 June 2008 at 13:47.

Thanks, thanks, thanks!!! I searched too much and your tutorial was the only that worked. Thanks again.

laurent: For me were no sound too, playing at Linux mplayer, but in Windows (Nokia Multimedia Player) and in the cellphone it worked.

saúl Says:

4 June 2008 at 19:46.

muchas gracias por la información, me sirvio de mucho. Me permito poner un ejemplo para convertir un video en formato mpeg a flv, con audio mp3:
ffmpeg -i video.mpg -f flv -acodec libmp3lame -ar 22050 -ab 64k -ac 1 video.flv

saludos desde México.

Travis Says:

9 June 2008 at 15:09.

The proper configure command is:

./configure –enable-nonfree –enable-libamr-nb –enable-libamr-wb –enable-libmp3lame

Travis Says:

9 June 2008 at 15:09.

Er, those are double dashes. WordPress doesn’t like that for some reason.

Crusher Says:

3 July 2008 at 04:45.

I also got those “undefined reference to” errors from libamr.c.
The reason is that the final gcc call doesn’t contain references to the amr libraries (I guess it still was my fault although I tried hard to configure and build all the needed stuff correctly).
Anyway, I wasn’t able to tweak Makefile as needed, so here is how one can do it by hand:

1. Copy the last gcc invocation from the make’s screen dump
2. Add -lamrnb -lamrwb to the end of command line and press return
3. Continue to ‘make install’ step.

Hope this helps someone.

Denie Says:

13 August 2008 at 07:02.


Can some1 help me ? Got below errors…

In file included from ffmpeg.c:33:
libavformat/framehook.h:25:2: warning: #warning VHOOK is deprecated. Please help finishing libavfilter instead of wasting your time writing new filters for this crappy filter system.
“/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/version.sh “/usr/local/src/efusion/ffmpeg-manual/ffmpeg” version.h
gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -I. -I”/usr/local/src/efusion/ffmpeg-manual/ffmpeg” -fomit-frame-pointer -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wcast-qual -Wwrite-strings -O3 -fno-math-errno -c -o cmdutils.o cmdutils.c
gcc -L”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libavdevice -L”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libavformat -L”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libavcodec -L”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libavutil -rdynamic -export-dynamic -Wl,–warn-common -Wl,–as-needed -Wl,-rpath-link,”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libpostproc -Wl,-rpath-link,”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libswscale -Wl,-rpath-link,”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libavfilter -Wl,-rpath-link,”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libavdevice -Wl,-rpath-link,”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libavformat -Wl,-rpath-link,”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libavcodec -Wl,-rpath-link,”/usr/local/src/efusion/ffmpeg-manual/ffmpeg”/libavutil -Wl,-Bsymbolic -o ffmpeg_g ffmpeg.o cmdutils.o -lavdevice -lavformat -lavcodec -lavutil -lz -lbz2 -lm -lamrnb -lm -lamrwb -lm -lmp3lame -lm -ldl -ldl
/usr/local/src/efusion/ffmpeg-manual/ffmpeg/libavcodec/libavcodec.a(libamr.o)(.text+0xdc): In function `amr_nb_encode_init’:
libavcodec/libamr.c:409: undefined reference to `VADxEncoder_Interface_init’
/usr/local/src/efusion/ffmpeg-manual/ffmpeg/libavcodec/libavcodec.a(libamr.o)(.text+0x1e0): In function `amr_nb_decode_frame’:
libavcodec/libamr.c:465: undefined reference to `GP3Decoder_Interface_Decode’
/usr/local/src/efusion/ffmpeg-manual/ffmpeg/libavcodec/libavcodec.a(libamr.o)(.text+0×270): In function `amr_nb_encode_frame’:
libavcodec/libamr.c:483: undefined reference to `GP3VADxEncoder_Interface_Encode’
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1
[root@lnx01 ffmpeg]#

Please help…

Guilherme Says:

27 November 2008 at 14:11.

God bless you!!!

TDI Web Log » Blog Archive » Converting Android 1.5 “Camcorder” videos with SAMR audio codec on Ubuntu Jaunty with ffmpeg Says:

2 June 2009 at 17:39.

[...] doesn’t have AMR compiled in because the AMR codec isn’t liberated/free.  I followed Chez’ instructions with a few modifications to get a tweaked ffmpeg that will convert videos recorded with my G1 [...]

Nikhil Says:

8 October 2009 at 19:17.

umm.. i got lost where it says cd ffmpeg … could someone PLEASE guide me after we get the ffmpeg from the svn ?

chirp.syxyz.net Says:

23 January 2010 at 16:07.

[...] with Chez Mattiouz’s guide on installing FFmpeg with MP3 and AMR support, we will make a few updates and modifications to get a more full-featured [...]

Metafaniel Says:

19 May 2010 at 10:57.

Converting AMR to MP3 using FFMPEG
ffmpeg -i audio1.amr -ar 22050 audio1.mp3
This will convert audio1.amr file to audio1.mp3 having audio rate 22.05 Khz

Leave a Reply