Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling libfdk_aac in ffmpeg installed with Homebrew

Tags:

On macOs I always used to install or update ffmpeg through Homebrew. I use the libfdk_aac audio codec a lot so I always did this:

brew reinstall ffmpeg --with-fdk-aac

For some reason, since one or two brew updates, ffmpeg can no longer be installed with libfdk_aac.

When converting a video and using -acodec libfdk_aac which has been working fine for years, I now get:

Unknown encoder 'libfdk_aac'

Is there a way to fix this?

like image 913
RocketNuts Avatar asked Mar 10 '19 21:03

RocketNuts


2 Answers

Homebrew v2.0 dropped all of the extra options that are not explicitly enabled in each formulae. So the --with options no longer work if you use the core Homebrew formulae.

Instead you can use a third-party repository (or "tap") such as ​homebrew-ffmpeg. This tap was created in response to the removal of the options from the core formulae.

Enable it then install ffmpeg:

brew tap homebrew-ffmpeg/ffmpeg brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac 

You can see a list of additional options with:

brew options homebrew-ffmpeg/ffmpeg/ffmpeg 

It's recommended to install a recent build from the git master branch. You can do so with the --HEAD option:

brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac --HEAD 
like image 138
llogan Avatar answered Oct 12 '22 02:10

llogan


You could use MacPorts to install ffmpeg with +nonfree option.

In summary, you'll need to:

  1. Install Xcode tools. Try xcode-select --install, or check Apple's developer website.

  2. Install MacPorts using the right pkg file for your MacOs release, or use one of the other options shown in the MacPorts installation guide.

  3. Install ffmpeg using MacPorts:

    $ sudo port install ffmpeg +nonfree

Which will ask:

--->  Computing dependencies for ffmpeg The following dependencies will be installed:  Xft2 XviD aom autoconf autoconf-archive automake brotli bzip2 cairo cctools curl-ca-bundle dav1d db48 expat fontconfig freetype fribidi gd2 gdbm gdk-pixbuf2 gettext gettext-runtime gettext-tools-libs giflib glib2 gmake gmp gnutls gobject-introspection graphite2 graphviz gts harfbuzz icu jasper jbigkit lame lcms2 libLASi libass libbluray libde265 libedit libfdk-aac libffi libheif libiconv libidn2 libjpeg-turbo libmodplug libnetpbm libogg libopus libpixman libpng librsvg libsdl2 libtasn1 libtextstyle libtheora libtool libunistring libvorbis libvpx libxml2 libxslt lz4 m4 nasm ncurses nettle openjpeg openssl openssl3 ossp-uuid p11-kit pango pcre perl5.28 perl5.30 pkgconfig py39-beaker py39-importlib-metadata py39-mako py39-markdown py39-markupsafe py39-setuptools py39-zipp python39 python3_select python_select rav1e readline shared-mime-info soxr speex sqlite3 texinfo tiff urw-fonts vala webp x264 x265 xorg-libX11 xorg-libXau xorg-libXaw xorg-libXdmcp xorg-libXext xorg-libXmu xorg-libXt xorg-libice xorg-libpthread-stubs xorg-libsm xorg-libxcb xorg-xcb-proto xorg-xcb-util xorg-xorgproto xpm xrender xz zimg zlib zstd zvbi Continue? [Y/n]: y    

That will install all of those. The libfdk-aac codec will be built optimised for your machine, as well as ffmpeg. All of that takes some time.

Result:

$ ffmpeg -codecs | grep libfdk AAC (Advanced Audio Coding) (decoders: aac aac_fixed aac_at libfdk_aac ) (encoders: aac aac_at libfdk_aac ) 

To see full codec list and supported formats:

$ ffmpeg -codecs $ ffmpeg -formats 

The other option would be to compile it yourself and choose whatever options you want.

like image 45
l'L'l Avatar answered Oct 12 '22 00:10

l'L'l