ffmpeg with xvid, h264 and libfaac on Ubuntu Intrepid

Posted on October 31st, 2008 at 00:10 in Linux, Ubuntu

I haven’t blogged for a while now, guess I need a new redesigned template, which seems to boost my blogging ability. But here is a simple and short guide to build ffmpeg with the appropriate codecs to encode stuff for the PSP or iPod. These codecs aren’t enabled by default to legal (patent) issues.

You should have the medibuntu repository enabled for this to work.

Get some tools to build tje package along with the ffmpeg source in Ubuntu Intrepid. Then get the appropriate packages to build ffmpeg, and satisfy the evil codec dependencies:

apt-get install dpkg-dev devscripts
apt-get source ffmpeg
apt-get build-dep ffmpeg
apt-get install libmp3lame-dev libfaac-dev libxvidcore4-dev libx264-dev

To finished up, go into the sources directory, build the package with the external codecs and install everything after it finishes building the debian package. Note that the first command is optional, and is just to bump the package version so that is “newer” that the original repositories:

dch -i
DEB_BUILD_OPTIONS=externalcodecs dpkg-buildpackage -rfakeroot -us -uc
dpkg -i *.deb

And that is it. Look for scripts that use ffmpeg to encode stuff for the PSP or iPod. There are plenty around. I’ll post my favourite at a later time.

5 Responses to “ffmpeg with xvid, h264 and libfaac on Ubuntu Intrepid”

  1. Quentin Smith said on November 5th, 2008 at 07:11 :

    Unfortunately, this isn’t enough to build with all of the codecs. You also need to make another couple patches:

    In debian/rules, change

    SVN_VERSION := $(shell echo $(SRC_VERSION) | sed -ne ’s/^[0-9]\.[a-z]*//p’)

    to

    SVN_VERSION := $(shell echo $(SRC_VERSION) | sed -ne ’s/^[0-9:]*\.[a-z]*//p’)

    Then run
    DEB_BUILD_OPTIONS=internalcodecs,externalcodecs debian/rules get-orig-source

    Then edit config-extra-includes.h and change all the defines from 0 to 1

    Finally, build with

    DEB_BUILD_OPTIONS=externalcodecs dpkg-buildpackage -rfakeroot -us -uc

    (the same as above)

    –Quentin

  2. Quentin Smith said on November 5th, 2008 at 07:11 :

    I’ve actually continued fighting with it; those steps aren’t quite right. After changing the SVN_VERSION line,

    DEB_BUILD_OPTIONS=internalencoders,externalcodecs debian/rules get-orig-source
    cd ..
    mv ffmpeg_3\:0.svn20080206.orig.tar.gz ffmpeg-debian_0.svn20080206.orig.tar.gz
    dpkg-source –no-check -x ffmpeg-debian_0.svn20080206-12ubuntu3.dsc
    DEB_BUILD_OPTIONS=internalencoders,externalcodecs dpkg-buildpackage -rfakeroot -us -uc

    should leave you with a working ffmpeg.

    –Quentin

  3. alfmatos said on November 6th, 2008 at 00:11 :

    @ Quentin

    Thanks for your feedback, its very enlightening, because in fact, you enabled all codecs, both internal and external. My objective was just those required to encode PSP video, aac xvid and x264, for which I think externalcodecs is sufficient, right ?

  4. Adam said on November 22nd, 2008 at 08:11 :

    I get an error at the end of the build using your original instructions

    dpkg-shlibdeps: failure: no dependency information found for /usr/lib/libx264.so.65 (used by debian/libavcodec51/usr/lib/libavcodec.so.51.50.0).
    dh_shlibdeps: command returned error code 512
    make: *** [binary-arch] Error 1
    dpkg-buildpackage: failure: fakeroot debian/rules binary gave error exit status 2

  5. alfmatos said on November 22nd, 2008 at 11:11 :

    @ Adam

    Hi Adam, it seems you are missing some libx264 dependencies. Can you try:

    apt-get build-dep libx264-59

    If that package doesn’t exist, look for the available package by searching for it:

    apt-cache search libx264

    Also, check if you have medibuntu properly enabled, as suggested by the link at the top of the post. The you should to build everything again, and let me know.

Leave a Reply