How to add aac and libx264 to FFmpeg installation?

5,483

I do this on a regular basis since I like to use ffmpeg's bleeding edge features now and then.

For libfdk-aac and libx264, you want to install the respective development packages:

sudo apt install libfdk-aac-dev libx264-dev

Then I configure ffmpeg like this:

./configure --prefix=/opt/ffmpeg-$(cat RELEASE) --enable-gpl --enable-nonfree --enable-version3 --enable-libx264 --enable-libfdk-aac --enable-pthreads --enable-postproc --enable-gnutls --disable-librtmp --disable-libopencv --disable-libopenjpeg --enable-libpulse --arch=amd64 --disable-shared --enable-static --disable-doc --extra-cflags=--static --extra-libs="-ldl" --disable-outdev=alsa --disable-outdev=oss --disable-outdev=v4l2 --disable-outdev=sndio --disable-indev=alsa --disable-indev=oss --disable-indev=sndio --disable-indev=jack

As you see, I explicitly enable libx264 and fdk-aac and I disable a lot of features I don't need. Your mileage may vary, of course. The fancy part is --prefix=/opt/ffmpeg-$(cat RELEASE) --disable-shared --enable-static --disable-doc --extra-cflags=--static --extra-libs="-ldl", which gives you a static compile. make install will put it into opt, so it does not conflict with the ffmpeg version provided by the package manager.

I do not actually execute make install, though. Instead I use

sudo checkinstall --pkgname="ffmpeg-$(cat RELEASE)" --pkgversion="$(cat RELEASE)~git$(git rev-parse --short HEAD)" --backup=no --deldoc=yes --fstrans=no --default

to produce a Debian package I can uninstall without hassle.

In case this information becomes obsolete, I probably update the corresponding post in my personal blog.

Share:
5,483

Related videos on Youtube

Stubot
Author by

Stubot

Updated on September 18, 2022

Comments

  • Stubot
    Stubot almost 2 years

    I've already installed FFmpeg according to the ffmpeg Ubuntu compile guide.

    I can't use aac audio encoding and libx264, which I need.

    How do I install FFmpeg so that all the option below are enabled in the installation? Do I need to uninstall FFmpeg and start over again, or can I just add to what has already been installed?

  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 10 years
    This is a questions and answers site. Please do not post an answer which is just a link to another site. At least summarize the content in your post. See How to Answer for more tips on writing answers.
  • johnstaveley
    johnstaveley over 2 years
    404 not found, update the link