Dec 20, 2008

HOWTO: compiling ffmpeg + x264 + MP3 + Xvid + AMR on Ubuntu

21/08/2013 - By popular demand (according to page view stats), I've decided to refresh this post for Ubuntu 12.04 : here is the updated HOWTO. Enjoy :)


ffmpeg is THE audio/video conversion tool. Unfortunately, the default build included in Ubuntu is usually quite outdated, as well as lacking support for many codecs.

The purpose of this article is to show you how you can build a fresh, up to date version of ffmpeg supporting (almost) all codecs. This procedure was successfully performed on Ubuntu 8.04 and 8.10.

0) Prerequisites

Before we start, let's check if subversion and git are installed. We'll need both to install some of the libraries required by ffmpeg:

ubuntu% svn
Type 'svn help' for usage.
ubuntu% git
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]
OK, they're both present. If not, you need to install them with the following commands:

ubuntu% sudo apt-get install subversionubuntu% sudo apt-get install git git-core
Now would be a good time to decide where you're going to build all those sources. Just create a temporary directory anywhere you like (you'll need less than 150MB).

[Updated on 2008/01/02] If you have an existing installation of ffmpeg, you may run into linking issues caused by conflicting library versions. My advice is to remove all existing copies of libav* (libavcodec and so on) which may be present in /usr/lib, either by uninstalling them with APT or by deleting the .a and .so files. Please read the comments below for additional information.
1) Fetching the ffmpeg sources

First of all, let's get the latest ffmpeg source snapshot from the Subversion server:

ubuntu% svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
lots of output removed
Checked out external at revision 28172.
Checked out revision 16245.

Of course, you could just go ahead with configure, make, make install and be done with it. Unfortunately (?), it's not that simple. Go ahead, run configure:

ubuntu% cd ffmpeg
ubuntu% ./configure
--prefix=/usr/local
lots of output removed
Creating config.mak and config.h...

Take a closer look at the output, especially at the 'Enabled encoders' section. A number of major formats, like AAC, MP3, x.264 or XViD are missing. Can you live without these? Probably not...

Why, oh why are they missing? Take another look at the output of the configure command:

libfaac enabled no
libmp3lame enabled no
libx264 enabled no
libxvid enabled no

These encoders are missing because they're handled by external libraries which are not part of the ffmpeg source package. Chasing them all is a bit of a pain in the #$$ and hopefully this article will help!

2) Configuring ffmpeg... and failing
Let's go wild and enable almost everything, including shared libraries (nice if you're running multiple copies of ffmpeg) and POSIX threads (additional parallelism can't hurt):

ubuntu% ./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-shared --enable-postproc --enable-avfilter --enable-avfilter-lavf --enable-pthreads --enable-x11grab --enable-bzlib --enable-libamr-nb --enable-libamr-wb --enable-libdc1394 --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libschroedinger --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib

It will inevitably lead to something like this:

FAAD test failed.
If you think configure made a mistake, make sure you are using the latest
version from SVN. If the latest version fails, report the problem to the
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.err" produced by configure as this will help
solving the problem.

It's normal, we haven't installed the external libraries required for our ffmpeg build. Let's get to it!

3) Installing libamr
This library is needed for 3GPP speech codecs. For legal reasons, it is not part of the standard Ubuntu repository. You can find it in the Medibuntu repository. Of course, you need to let APT know about this new repository. These are the commands for Ubuntu 8.04 (more information on other versions here):

ubuntu% sudo wget http://www.medibuntu.org/sources.list.d/hardy.list --output-document=/etc/apt/sources.list.d/medibuntu.list
ubuntu% sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
Now you can install libamr:

ubuntu% sudo apt-get install libamrnb-dev libamrwb-dev
4) Installing libnut

NUT is a container format under construction by MPlayer and FFmpeg developers. Libnut needs to be built from source:

ubuntu% svn co svn://svn.mplayerhq.hu/nut/src/trunk/ nut
ubuntu% cd nut
ubuntu% make
ubuntu% sudo make install

5) Installing libx264

x264 is a free library for encoding H264/AVC video streams.

It can be fetched with APT using 'apt-get install libx264-dev' but let's make sure we have both the latest ffmpeg and the latest x264.

Before we build the x264 source, we need to install
  • libgpac, required to support the mp4 container with the x264 codec,
  • the yasm assembler, required to compile several assembly language routines present in the x264 code.
Installing libgpac is straightforward:

ubuntu% sudo apt-get install libgpac-dev

Now, let's take a look at yasm:

ubuntu% yasm --versionzsh: command not found: yasm
It's not there. Let's get it using APT:

ubuntu% sudo apt-get install yasmubuntu% yasm --version
yasm 0.5.0.1591

OK, now let fetch the x264 source and configure the build:

ubuntu% git clone git://git.videolan.org/x264.git
ubuntu% cd x264
ubuntu% ./configure --prefix=/usr/local --enable-shared
Found yasm 0.5.0.1591
Minimum version is yasm-0.6.1
If you really want to compile without asm, configure with --disable-asm.

Hmmm.. Do we want to use generic C routines instead of optimized assembly? No. Let's build the latest yasm (0.7.2 at the time of this writing):

ubuntu% sudo apt-get remove yasm
ubuntu% wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.2.tar.gz
ubuntu% tar xvfz yasm-0.7.2.tar.gzubuntu% cd yasm-0.7.2
ubuntu% ./configure --prefix=/usr/local
ubuntu% make
ubuntu% sudo make install
ubuntu% yasm --version
yasm 0.7.2.2153


OK, now we can build x264:

ubuntu% cd x264ubuntu% ./configure --prefix=/usr/local --enable-shared
output removed
Platform: X86
System: LINUX
asm: yes
avis input: no
mp4 output: yes
pthread: yes
debug: no
gprof: no
PIC: no
shared: yes
visualize: no
ubuntu% make
ubuntu% sudo make install

6) Installing libxvid

Before we install libxvid, we need to check that the nasm assembler is OK. It's required to build assembly code in libxvid and you do NOT want this code to be replaced with generic C code in case nasm is missing : I ran some Xvid encoding tests with and without assembly code and there's a 2.5x factor... So read on :)

You need at least nasm 2.0, so let's check the default version on Ubuntu 8.04 and Ubuntu 8.10:

ubuntu8.04% sudo apt-get install nasm
ubuntu8.04% nasm -vNASM version 0.99.06-20071101 compiled on Sep 16 2008
ubuntu8.10% sudo apt-get install nasmubuntu8.10% nasm -v
NASM version 2.03.01 compiled on Jun 19 2008

So, if you have 8.10, you're good to go and you can skip the rest of this section. If you have 8.04, follow me:

ubuntu% sudo apt-get remove nasmubuntu% wget http://www.nasm.us/pub/nasm/releasebuilds/2.05.01/nasm-2.05.01.tar.gz
ubuntu% tar xvfz nasm-2.05.01.tar.gzubuntu% cd nasm-2.05.01ubuntu% ./configure --prefix=/usr/localubuntu% make
ubuntu% sudo make installubuntu% nasm -vNASM version 2.05.01 compiled on Dec 23 2008

Now, let's fetch the xvid sources and build them:

ubuntu% wget http://downloads.xvid.org/downloads/xvidcore-1.2.1.tar.gz
ubuntu% tar xvfz xvidcore-1.2.1.tar.gz
ubuntu% cd xvidcore/build/generic
ubuntu% ./configure --prefix=/usr/local
ubuntu% make
lots of output removed
---------------------------------------------------------------
Xvid has been successfully built.

* Binaries are currently located in the '=build' directory
* To install them on your system, you can run '# make install'
as root.
---------------------------------------------------------------

ubuntu% sudo make install
7) Installing everything else
All the other libraries we need are part of the standard Ubuntu repository. Let's install them all with a single command:

ubuntu% sudo apt-get install
libfaac-dev libfaad-dev libschroedinger-dev libtheora-dev libvorbis-dev libxv-dev libxvmc-dev
We also need to install the LAME MP3 encoder. The name of the library differs on Ubuntu 8.04 and Ubunto 8.10, so choose wisely :)

ubuntu8.04% sudo apt-get
install liblame-dev

ubuntu8.10% sudo apt-get install libmp3lame-dev

8) Configuring ffmpeg... and succeeding!

We should have everything we need now. Let's try that configure command again:

[Updated on 2009/02/18 : the '--enable-xvmc' flag has been removed. XVMC support now seems to be integrated by default. If you're using an old build, please add the flag to the command line below]

[Updated on 2009/03/09 : the '--enable-swscale' flag has been removed. This library is now built by default. If you're using an old build, please add the flag to the command line below]

ubuntu% cd ffmpeg
ubuntu% ./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-shared --enable-postproc --enable-avfilter --enable-avfilter-lavf --enable-pthreads --enable-x11grab --enable-bzlib --enable-libamr-nb --enable-libamr-wb --enable-libdc1394 --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libschroedinger --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zliblots of output removed
License: unredistributable
Creating config.mak and config.h...
All right. Let's build it.

9) Building ffmpeg
That's the easiest bit!
ubuntu% make
LOTS of output removed
ranlib libavutil/libavutil.a
rm doc/ffserver.pod doc/ffmpeg.pod doc/ffplay.pod
ubuntu% sudo make install
That's it. Cool, huh? Before you can start playing with your ffmpeg binary, you need to register those new dynamic libraries in /usr/local/lib (I'm using zsh. the syntax may be different if you're using another shell):

ubuntu% LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
ubuntu% export LD_LIBRARY_PATH
ubuntu% sudo ldconfig
Now, let's check this new ffmpeg:

ubuntu% which ffmpeg
/usr/local/bin/ffmpeg
ubuntu% ffmpeg -formats
lots of output removed
Pretty good list of codecs, isn't it?

10) Cleaning up
If like me you keep building the latest version, you will eventually end up with a lot of unecessary libraries in /usr/local/lib, e.g.:
ubuntu% cd /usr/local/lib
ubuntu% ls -l libav*
-rw-r--r-- 1 root root 24108334 2009-02-20 11:15 libavcodec.a
lrwxrwxrwx 1 root root       21 2009-02-20 11:15 libavcodec.so -> libavcodec.so.52.15.0
lrwxrwxrwx 1 root root       21 2009-02-20 11:15 libavcodec.so.52 -> libavcodec.so.52.15.0
-rwxr-xr-x 1 root root  5791060 2009-02-04 11:34 libavcodec.so.52.11.0
-rwxr-xr-x 1 root root  5791192 2009-02-05 15:29 libavcodec.so.52.12.0
-rwxr-xr-x 1 root root  5791228 2009-02-10 17:46 libavcodec.so.52.14.0
-rwxr-xr-x 1 root root  5774920 2009-02-20 11:15 libavcodec.so.52.15.0
-rw-r--r-- 1 root root   467478 2009-02-20 11:15 libavdevice.a
lrwxrwxrwx 1 root root       21 2009-02-20 11:15 libavdevice.so -> libavdevice.so.52.1.0
lrwxrwxrwx 1 root root       21 2009-02-20 11:15 libavdevice.so.52 -> libavdevice.so.52.1.0
-rwxr-xr-x 1 root root    39492 2009-02-20 11:15 libavdevice.so.52.1.0
-rw-r--r-- 1 root root    63220 2009-02-20 11:15 libavfilter.a
lrwxrwxrwx 1 root root       20 2009-02-20 11:15 libavfilter.so -> libavfilter.so.0.3.0
lrwxrwxrwx 1 root root       20 2009-02-20 11:15 libavfilter.so.0 -> libavfilter.so.0.3.0
-rwxr-xr-x 1 root root    17876 2009-02-20 11:15 libavfilter.so.0.3.0
-rw-r--r-- 1 root root  6259158 2009-02-20 11:15 libavformat.a
lrwxrwxrwx 1 root root       22 2009-02-20 11:15 libavformat.so -> libavformat.so.52.29.0
lrwxrwxrwx 1 root root       22 2009-02-20 11:15 libavformat.so.52 -> libavformat.so.52.29.0
-rwxr-xr-x 1 root root   766736 2009-02-05 15:29 libavformat.so.52.25.0
-rwxr-xr-x 1 root root   770972 2009-02-10 17:46 libavformat.so.52.26.0
-rwxr-xr-x 1 root root   771072 2009-02-12 16:57 libavformat.so.52.27.0
-rwxr-xr-x 1 root root   775232 2009-02-13 11:22 libavformat.so.52.28.0
-rwxr-xr-x 1 root root   767108 2009-02-20 11:15 libavformat.so.52.29.0
-rw-r--r-- 1 root root   225672 2009-02-20 11:15 libavutil.a
lrwxrwxrwx 1 root root       20 2009-02-20 11:15 libavutil.so -> libavutil.so.49.14.0
lrwxrwxrwx 1 root root       20 2009-02-20 11:15 libavutil.so.49 -> libavutil.so.49.14.0
-rwxr-xr-x 1 root root    55508 2009-02-20 11:15 libavutil.so.49.14.0
There's nothing really wrong here, but for the sake of clarity, you may want to remove the old libraries, i.e. the ones NOT linked as lib*.so.

That's it for today :)

45 comments:

  1. Worked all fine, thanks for that how to.

    Just one little thing
    ffmpeg -formats
    brings up an error
    ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_lfg_init

    got any idea if I need to fix this, and how?

    ReplyDelete
  2. av_lfg_init() is normally part of libavutil. Maybe you have an older version of libavutil in /usr/lib which doesn't have this symbol?

    Just remove the .a & .so files and run 'ldconfig -v' as root. BTW, you may have to do the same for libavcodec, libavdevice, libavfilter and libavformat as well.

    That should fix it, but let me know :)

    ReplyDelete
  3. removed the libavutil.a & .so as well as the libavcodec.a &.so everything else wasn't present.

    after that i ran ldconfig -v as sudo, but the Error remains.

    ReplyDelete
  4. followed the tutorial again after deleting them all, now it works.

    Maybe you should add a comment to delete these files before starting

    Thanks for your help and this great tutorial

    ReplyDelete
  5. Great! I guess some linking is needed as well.I will update the post accordingly.

    And thanks for the kind words :)

    ReplyDelete
  6. Hi, great blog! I've been following a lot of your posts. Thank you for sharing your knowledge, I'm learning a lot.

    I have run into a bit of a snag though, I've managed to successfully configure ffmpeg but when I run make it hangs-up with this error.

    /usr/bin/ld: /usr/local/lib/libnut.a(muxer.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
    /usr/local/lib/libnut.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: *** [libavformat/libavformat.so.52] Error 1

    I did try removing libnut.a then recompiling it (per this post), but again after configuring and making ffmpeg I get the same error. Any ideas? (8.10 Ubuntu Server AMD64).

    Thanks!

    ReplyDelete
  7. Excellent tutorial, helped me a lot!

    Quick tip for those of us running on a x86_x64 (AMD64) architecture. When building ffmpeg, you may encounter the following error coming from libnut.a(muxer.o):

    relocation R_X86_64_32 against `a local symbol' can not be used when making a shared
    object;


    To fix that, you'll have to rebuild libnut with the -fPIC switch. Simply add this switch in libnut's config.mak along the other parameters for the CFLAGS variable, or adding the following line to the file:

    CFLAGS += -fPIC

    Then you can rebuild libnut:

    ubuntu% cd nut
    ubuntu% sudo make uninstall
    ubuntu% sudo make distclean
    ubuntu% make
    ubuntu% sudo make install

    And then rebuilding ffmpeg.

    ReplyDelete
  8. That did it! Thank you chupstix it worked like a charm.

    ReplyDelete
  9. In step 7
    "ubuntu% sudo apt-get install libfaac-dev libfaad-dev libavcodec-dev libmp3lame-dev libschroedinger-dev libtheora-dev libvorbis-dev libxv-dev libxvmc-dev"

    libavcodec-dev is not required, and may cause problems because this is part of ffmpeg.

    ReplyDelete
  10. @ マーク:

    you're right. Damn cut & paste :) I fixed it in the entry. Thanks!

    ReplyDelete
  11. I have run into two glitches:

    1) In step 7, we install "everything else" with this command:

    ubuntu% sudo apt-get install libfaac-dev libfaad-dev libmp3lame-dev libschroedinger-dev libtheora-dev libvorbis-dev libxv-dev libxvmc-dev

    but the file in bold is not found in Ubuntu 8.04, but is in 8.10. How do I install it?

    2) When I run configure in step 8, it always fails with "FAAD test failed." When I look in the config.err file, i see that it cannot find a certain directory:

    BEGIN /tmp/ffmpeg-conf--21846-.c
    1 int x;
    END /tmp/ffmpeg-conf--21846-.c
    gcc -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -c -o /tmp/ffmpeg-conf--21846-.o /tmp/ffmpeg-conf--
    21846-.c
    check_header faad.h
    check_cpp
    BEGIN /tmp/ffmpeg-conf--21846-.c
    1 #include faad.h
    2 int x;
    END /tmp/ffmpeg-conf--21846-.c
    gcc -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -E -o /tmp/ffmpeg-conf--21846-.o /tmp/ffmpeg-conf--
    21846-.c
    /tmp/ffmpeg-conf--21846-.c:1:18: error: faad.h: No such file or directory
    FAAD test failed.

    Any idea how i can fix this?

    ReplyDelete
  12. If you are getting a FAAD error, try installing the FAAD dev files.

    Try:
    sudo apt-get install libfaad-dev

    Hope that helps!

    ReplyDelete
  13. @Randy:

    Regarding your first problem, here's the fix. The name of the library in Ubuntu 8.04 is liblame-dev. It was renamed to libmp3lame-dev in Ubuntu 8.10. I'll update the post.

    Regarding your second problem, I'm not sure. Let me check :)

    Cheers!

    ReplyDelete
  14. @Randy: are you sure you installed libfaad-dev (and not libfaad)? You can check with 'dpkg -l|grep faad-dev'. If it's installed, you should see faad.h in /usr/include.

    ReplyDelete
  15. @JS: yes, I installed libfaad-dev as you suggested and now all is well. Thank you.

    ReplyDelete
  16. Thanks for the great how-to.

    Like Sk1ink I have the same problem:
    ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_lfg_init

    I followed your instructions and those of Sk1nk by following the how-to.

    After starting mediatomb I can transcode a mkv file once. After stopping the transcoding, the same error keeps coming back.

    Any ideas on how to get rid of the error ?
    Thanks

    ReplyDelete
  17. Hi,

    I have Ubuntu 8.10.
    I keep repeating the steps, but I keep getting this error message after "make":
    make: *** [libavformat/libavformat.so.52] Error 1

    I can't make ffmpeg to work, and when I do the ./configure line, it seems like most libraries get enabled, but I just can't get "make" to work out. I've tried many ways and days but don't see to know what's wrong.

    Thanks!

    Ed

    ReplyDelete
  18. Got a new one.
    After it worked fine for some weeks, now mp4ize keeps saying

    "Couldn't figure out aspect ratio."

    even on movies which I mp4ized last time it worked.

    Any idea what happend and how to fix it?

    ReplyDelete
  19. Me again, played a little with it, and found out that this error is my old friend again.

    So I did the steps 1, 2 and 8) + 9) again now it works fine.

    Think this happens if synaptic updates ffmpeg.

    ReplyDelete
  20. @decibo

    I had the same problem, I fixed it using chupstix tip and rebuilding nut. Hope this helps for you

    ReplyDelete
  21. Hey anonymous,

    I rebuilt nut using his solution, and it works. thanks a lot man!

    Ed

    ReplyDelete
  22. I owe you a beer or better. Your great howto saved me a lot of time and my a** at least. Thank you so much!

    ReplyDelete
  23. @sascha: LOL. Glad I could help :)

    ReplyDelete
  24. For me the problem with the aspect ratio returns after rebooting.

    since i couldn't find a solution i keep repeating the steps.

    Any ideas?

    ReplyDelete
  25. Thanks man..

    Your tutorial is very good..

    Congratulations..

    ReplyDelete
  26. Okay, revisiting this one again. It all works when it works, but when it doesn't, which is after every reboot and sometimes just randomly, i have to do the LD_LIBRARY_PATH thingy. I'd rather not have to do that every so often... Any idea what the problem could be?

    ReplyDelete
  27. @Magnus: the easiest and most foolproof solution is to set LD_CONFIG_PATH in you.cshrc file (or equivalent, depending on what shell you use) :)

    ReplyDelete
  28. I'm thankful for the help I received using this guide :) Great work !!
    Just wanted to add that swscale now is enbled by default so you should exclude the --enable-swscale when configuring.

    I was haunted by old libav* so be sure to clean up before starting.
    Cheers !!

    ReplyDelete
  29. Hi Alex! Thanks, you beat me to it :) I updated the entry.

    ReplyDelete
  30. I would just like to include that if you are following these steps to eventually build vlc, you will want to use a snapshot of x264 that is not so current. I was successful when I used:

    wget http://downloads.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20090101-2245.tar.bz2

    (suggestion given by maurixio in the comments of the compiling vlc post)

    Maybe this blog post should be updated to use that rather than whats in git.

    ReplyDelete
  31. Not only a nice howto but a good tutorial. Thanks. For Jaunty Jackalope, I got the following error:

    ffmpeg: symbol lookup error: ffmpeg: undefined symbol: avformat_alloc_context

    This was fixed by removing --enabled-shared from the configure.

    ReplyDelete
  32. Hey, how ya doin'?

    I was following your guide, then I found out that it is possible to compile it as a .deb package, via the 'sudo checkinstall -D make install' command instead of the classical 'make && sudo make install'. This saves a lot of time if you need to re-install your distro for some reason.

    Thanks for this guide!

    ReplyDelete
  33. was trying the ./cfg that you had and there was 4 lib's not there
    --enable-libamr-nb --enable-libamr-wb --enable-libdc1394 --enable-libgsm

    this took care of the libamr
    ubuntu% Wget http://debian-multimedia.org/pool/main/o/opencore-amr/opencore-amr_0.1.1.orig.tar.gz
    ubuntu% tar xvfz opencore-amr_0.1.1.orig.tar.gz
    ubuntu% cd opencore-amr-0.1.1.orig
    ubuntu% make
    ubuntu% sudo make install

    I had to chang there switches to
    --enable-libopencore-amrnb --enable-libopencore-amrwb
    and i added --enable-version3

    i got the other 2 just dont rember how thou.

    ReplyDelete
  34. A way to get around the use of opencore-amr (which was problematic to build on 9.04) is to revert to revision 19071 (rather than the latest).

    svn checkout -r 19071 svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg

    ReplyDelete
  35. Hi,

    When I run make for ffmpeg I get the error:
    /ffmpeg/libswscale/libswscale.so: undefined reference to `av_clip_uint16'
    collect2: ld returned 1 exit status
    make: *** [ffmpeg_g] Error 1

    Any ideas?

    TIA!

    ReplyDelete
  36. I think I fixed it...

    svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk libswscale

    then copied the file common.h from ~/temp/libswscale/libavutil to ~/temp/ffmpeg/libavutil

    make seems to have had succeeded.

    ReplyDelete
  37. Thank you Julien for sharing this, I wish I spotted your guide last night but fortunately ldconfig is a very good friend of mine.

    Your other x264 adventures look 'really' interesting, I'll definitely be needing to look at those very soon :)

    ps You're linkedin but no twittered ?

    ReplyDelete
  38. Hi
    Many thanks for the great How-To. Everything works great.
    Unfortunately I'm having problems with installing services that require libav. I re-installed a service called mt-daapd which can publish a specific folder to appear as a Shared Library in iTunes. This package depends on libavcodec, libavcodec52 and libavutil49. Those libs get installed in /usr/lib. As soon as they are there, ffmpeg is broken. I get this eraror message: ffmpeg: symbol lookup error: /usr/local/lib/libavdevice.so.52: undefined symbol: avfreepacket I really do not know what is going on as it points to the correct lib in /usr/local/lib. There must be a problem with library linking or something, I guess. I am no Ubuntu expert, but shouldn t it be possible for local libs to co-exist with system wide libs? When I uninstall libavcodec libs from /usr/lib and re-install ffmpeg, it is working again. But that automatically removes mt-daapd. I guess the same would happen if I d install any other package (like vlc...) that is dependent on those libav*-libs in /usr/lib Can you see my dilemma? This is driving me nuts as I can t find a solution for this. How can I tell mt-daapd to use the libraries in /usr/local/lib and don`t install its dependencies?

    Any help or advice would be highly appreciated. Thanks

    ReplyDelete
  39. Who knows where to download XRumer 5.0 Palladium?
    Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!

    ReplyDelete
  40. I've made a similar post on this. I needed ffmpeg with aac on ubuntu on ps3. I didn't need amr. My copy-and-pastable commands and debs are available at

    http://nabstersblog.blogspot.com/2009/05/ffmpeg-with-aac-on-ubuntu.html

    ReplyDelete
  41. I 've installed ffmpeg with opencore-amr-nb wb codec . Cmd is :
    cd ffmpeg
    ./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-shared --enable-postproc --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3



    installation done properly with make & make install..

    now i wanted to convert mp4, mpeg, avi file to 3gp with audio as amr !

    [root@tv2 mp4]# ffmpeg -i saathiya.mp4 -ab 8.85k -acodec opencore-amrwb -ac 1 -ar 16000 -vcodec h263 -s qcif s.3gp
    FFmpeg version SVN-r21363, Copyright (c) 2000-2010 Fabrice Bellard, et al.
    built on Jan 22 2010 12:22:46 with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)
    configuration: --prefix=/usr/local --enable-gpl --enable-nonfree --enable-shared --enable-postproc --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3
    libavutil 50. 7. 0 / 50. 7. 0
    libavcodec 52.48. 0 / 52.48. 0
    libavformat 52.47. 0 / 52.47. 0
    libavdevice 52. 2. 0 / 52. 2. 0
    libswscale 0. 9. 0 / 0. 9. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'saathiya.mp4':
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: mp41
    title : saathiya
    encoder : Lavf52.2.0
    Duration: 00:03:01.30, start: 0.000000, bitrate: 162 kb/s
    Stream #0.0(und): Video: mpeg4, yuv420p, 128x96 [PAR 1:1 DAR 4:3], 123 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
    Stream #0.1(und): Audio: aac, 22050 Hz, mono, s16, 37 kb/s
    Unknown encoder 'opencore-amrwb'


    surprizing result !!! dont fine opencore-amrwb .. i tried with multiple options.. no use

    ReplyDelete
  42. My mistake. its working now. !! Thanks for ur detailed post. it helped me to get stuff installed in correct way !

    [root@tv2 mp4]# ffmpeg -i kiss.mp4 -acodec libopencore_amrnb -ab 12.2k -ar 8000 -ac 1 -vcodec h263 -s qcif movie.3gp
    FFmpeg version SVN-r21363, Copyright (c) 2000-2010 Fabrice Bellard, et al.
    built on Jan 22 2010 12:22:46 with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)
    configuration: --prefix=/usr/local --enable-gpl --enable-nonfree --enable-shared --enable-postproc --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3
    libavutil 50. 7. 0 / 50. 7. 0
    libavcodec 52.48. 0 / 52.48. 0
    libavformat 52.47. 0 / 52.47. 0
    libavdevice 52. 2. 0 / 52. 2. 0
    libswscale 0. 9. 0 / 0. 9. 0
    libpostproc 51. 2. 0 / 51. 2. 0

    Seems stream 0 codec frame rate differs from container frame rate: 30.00 (30/1) -> 15.00 (15/1)
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'kiss.mp4':
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: mp41
    encoder : 3GP_Converter051103 www.nurs.or.jp/~calcium FFmpeg2.40b((49<<16)+(1<<8)+0)
    encoder-eng : 3GP_Converter051103 www.nurs.or.jp/~calcium FFmpeg2.40b((49<<16)+(1<<8)+0)
    Duration: 00:00:27.00, start: 0.000000, bitrate: 352 kb/s
    Stream #0.0(und): Video: h264, yuv420p, 176x144, 221 kb/s, PAR 12:11 DAR 4:3, 15 fps, 15 tbr, 90k tbn, 30 tbc
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 127 kb/s
    Output #0, 3gp, to 'movie.3gp':
    Stream #0.0(und): Video: h263, yuv420p, 176x144 [PAR 12:11 DAR 4:3], q=2-31, 200 kb/s, 15 tbn, 15 tbc
    Stream #0.1(und): Audio: libopencore_amrnb, 8000 Hz, 1 channels, s16, 12 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1
    Press [q] to stop encoding
    frame= 405 fps=213 q=2.3 Lsize= 841kB time=26.78 bitrate= 257.4kbits/s
    video:790kB audio:42kB global headers:0kB muxing overhead 1.148057%
    [root@tv2 mp4]# ffmpeg -i kiss.mp4 -acodec libopencore_amrnb -ab 12.2k -ar 8000 -ac 1 -vcodec h263 -s qcif movie.3gp

    Cheers,
    Mahendra

    ReplyDelete
  43. Hi,

    just adding my experience, after re-compiling ffmpeg for second time I got stuck in a message that said something like: libavcodec/libavcodec.so: undefined reference x264_encoder_open_83 .

    So I followed tips at first comments by removing files libav*.a and libav*.so inside /usr/lib. That wasn't enough and I needed to make distclean inside ffmpeg directory and also inside x264 directory. Thanks.

    ReplyDelete
  44. Hi,

    In Karmic, I had to do

    touch /etc/ld.so.nohwcap

    before updating the ldconfig cache. Seems to be related with this:

    https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/384764

    ReplyDelete
  45. very good article. I'm using Fedora 16. I used this command (as root) to register the shared objects after building ffmpeg:
    echo /usr/local/lib >> /etc/ld.so.conf

    ldconfig

    it also helps to add the rpmfusion repository for things like libgpc

    (as sudo)
    rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

    if you keep getting build errors, remember that some items need both the package, and the development package. in this article, you're instructed to install libgpac, which for fedora (with the rpmfusion repository) is yum install gpac (not libgpac). you can also install gpac-devel which is the development package for gpac. For some packages, this can resolve your configure / make errors. Just add -devel to the end of your package name.

    ReplyDelete