Roll your own ffmpeg build

I like to have my own build of ffmpeg. That way I don’t have to worry about not having this or that codec available. What I do is keep it in my ~/Applications/ffmpeg folder. Some people suggest using a ~/bin directory but I hate to drop every binary into the same place.

Here are the magic lines:

cd ~/Applications

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

cd ffmpeg

sudo apt-get install libmp3lame-dev libfaad-dev libfaac-dev\
 libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev\
 libtheora-dev libvorbis-dev

./configure --enable-gpl --enable-nonfree --enable-libmp3lame\
--enable-libfaac --enable-libfaad --enable-libtheora \
--enable-libvorbis --enable-libx264 --enable-libxvid

make

Once that finishes, you get an ffmpeg executable in the ~/Applications/ffmpeg folder. So you can explicitly call from your scripts with ~/Applications/ffmpeg/ffmpeg. And because it has a ton of enabled codecs, it’s less problematic to read videos from different sources than it is with the default build which comes with Ubuntu. Or even output videos using codecs such as mp3.

This will probably surely fail in a future version of Ubuntu, but it works as of today. Of course, if the libraries’ names change, you’ll have to adjust as appropriate too. It might also fail if the very svn checkout you do is not compiling properly, but hey! that’s the fun of living in the bleeding edge :-P

Instantanea for Android

Comments

  • I’ve been lately using GNU Stow (http://www.gnu.org/software/stow/) in order to have a ~/local/ directory tree similar to /usr/local, while having each application in its own subtree, which it’s great when uninstalling. Maybe you’ll like it :)

  • Oh I see. But I guess it’s too overkill for just one application :-)
    I usually just use the ‘default’ builds, and don’t really bother about compiling everything else.

    In fact, I like ffmpeg because compiling it is SO EASY! Simply configure & make. Whenever I get some sources, look at the README or INSTALL and see a long list of strange requirements like me modifying config files, or anything too esoteric which could have been automated from the build system point of view, I just abandon that project or try to find a ready-to-download build elsewhere.

  • To keep things tidy there’s a beautiful tool called stow, highly recommended for packages compiled by hand. Mmmm… I’m sure I’ve commented this already!

    That Applications dir sounds… too mac, doesn’t it? XD

  • D’oh! … slack wins.

  • It seems like every release of Ubuntu puts codes in different package configurations. Super annoying.

    Gnu Stow sounds like a cool idea, but isn’t it just as simple to create a ‘bin’ directory in your home folder and install apps there? On most distros it’s already included in your path.