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)
MP3 LAME:
- Grab the latest sources from the MP3 LAME official site:
e.g. lame-3.97.tar.gz - Decompress the source code:
gunzip lame-3.97.tar.gz
tar xvf lame-3.97.tar - Change directory:
cd lame-3.97 - Configure and install:
./configure
make
make install (as root or sudo)
AMR (NB & WB):
- Grab the AMR Codec Libraries (The FFmpeg documentation has a section about installing AMR):
e.g. amrnb-6.1.0.4.tar.bz2 and amrwb-7.0.0.1.tar.bz2 - Decompress sources:
bunzip2 amrnb-6.1.0.4.tar.bz2
tar xvf amrnb-6.1.0.4.tar - Change directory:
cd amrnb-6.1.0.4 - Configure and install:
./configure
make
make install (as root or sudo) - Repeat same steps 2,3 and 4 for amrwb-7.0.0.1.tar.bz2
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
FFmpeg
- We need to get FFmpeg from the subversion repository:
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg - Change directory:
cd ffmpeg - Configure and install:
./configure –enable-libamr_nb –enable-libamr_wb –enable-libmp3lame
make
make install (as root or sudo)
After that you should be able to use FFmpeg to encode flv or 3gp etc… with sound.
17 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.
Hi,
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
Thanks
Satyam
agtest Says:
23 January 2008 at 01:49.
Hi,
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
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.
Cheers.
RailsRoller Says:
1 April 2008 at 06:45.
Hi,
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??
Thanks
fiva Says:
8 April 2008 at 02:57.
RailsRoller:
./configure –help
laurent Says:
31 May 2008 at 12:41.
hello
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.
Hi,
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+0×1e0): 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…
Thanks,
Denie
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 [...]
