Skip to content

Instantly share code, notes, and snippets.

@Piasy
Last active December 4, 2024 18:57
Show Gist options
  • Save Piasy/b5dfd5c048eb69d1b91719988c0325d8 to your computer and use it in GitHub Desktop.
Save Piasy/b5dfd5c048eb69d1b91719988c0325d8 to your computer and use it in GitHub Desktop.
brew install ffmpeg with all options
brew options ffmpeg
brew install ffmpeg \
--with-chromaprint \
--with-fdk-aac \
--with-fontconfig \
--with-freetype \
--with-frei0r \
--with-game-music-emu \
--with-libass \
--with-libbluray \
--with-libbs2b \
--with-libcaca \
--with-libgsm \
--with-libmodplug \
--with-libsoxr \
--with-libssh \
--with-libvidstab \
--with-libvorbis \
--with-libvpx \
--with-opencore-amr \
--with-openh264 \
--with-openjpeg \
--with-openssl \
--with-opus \
--with-rtmpdump \
--with-rubberband \
--with-sdl2 \
--with-snappy \
--with-speex \
--with-tesseract \
--with-theora \
--with-tools \
--with-two-lame \
--with-wavpack \
--with-webp \
--with-x265 \
--with-xz \
--with-zeromq \
--with-zimg
@Albertdup
Copy link

Albertdup commented May 28, 2020

Any way of adding Nvidia NVENC support to the options? I am using Linux Ubuntu 20.04

@robatron
Copy link

@df-a , worked like a charm, thanks!

@Piasy
Copy link
Author

Piasy commented Jun 14, 2020

@df-a Good job man! 👍

A small note: please make sure pkg-config is installed, which could be installed by brew install pkg-config, otherwise ./configure could fail with ERROR: libass not found using pkg-config.

@jasonpaulmichaels
Copy link

jasonpaulmichaels commented Jun 23, 2020

Hey everyone, total newbie here...

I just wiped a machine and did a complete reload of Catalina, updated all patches, etc. I then installed Xcode via the Appstore, rebooted, install Homebrew via terminal with the default Home-brew install command

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

and then ran this series of terminal commands to install FFMPEG w/ all options --

brew uninstall --force --ignore-dependencies ffmpeg
brew install chromaprint amiaopensource/amiaos/decklinksdk
brew tap homebrew-ffmpeg/ffmpeg
brew upgrade homebrew-ffmpeg/ffmpeg/ffmpeg $(brew options homebrew-ffmpeg/ffmpeg/ffmpeg | grep -vE '\s' | grep -- '--with-' | grep -vi chromaprint | tr '\n' ' ')

The only error I received was after running the last command which was --

Error: ffmpeg: An unsatisfied requirement failed this build.

I am uncertain if this is something I need to be worried about? Can anyone provide any information?

If anyone cares to look, the linked TXT file has the entire terminal cache on the commands entered and the results. I didn't want to post it in the thread for fear it wouldn't collapse and then you'd have to scroll through all of it.

And while I'm here, not to Hi-Jack, but as a part of FFMPEG and my workflow I need to install AppleVideoToolbox to activate hardware compression on this new iMac 27" -- can anyone comment on that?

Thank you!

@zoharbabin
Copy link

This worked for me -

brew uninstall --force --ignore-dependencies ffmpeg
brew install chromaprint amiaopensource/amiaos/decklinksdk
brew tap homebrew-ffmpeg/ffmpeg
brew install ffmpeg
brew cask install xquartz
brew upgrade homebrew-ffmpeg/ffmpeg/ffmpeg $(brew options homebrew-ffmpeg/ffmpeg/ffmpeg | grep -vE '\s' | grep -- '--with-' | grep -vi chromaprint | tr '\n' ' ')

Note the addition of brew cask install xquartz.

@raedatoui
Copy link

@zoharbabin I think you need to specify which ffmpeg to install after you tap homebrew-ffmpeg/ffmpeg ?

...
brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-chromaprint

@df-a
Copy link

df-a commented Sep 30, 2020

Any way of adding Nvidia NVENC support to the options? I am using Linux Ubuntu 20.04

You can find info specific for your case here:

https://atlex00.com/linux/ffmpeg

@Qix-
Copy link

Qix- commented Sep 30, 2020

@df-a the text of the link does not match the link of that link. It leads me to believe you're doing something nefarious. Care to correct it? A fair number of eyeballs hit this page. We wouldn't want people clicking on any malicious links.

@df-a
Copy link

df-a commented Sep 30, 2020

@df-a the text of the link does not match the link of that link. It leads me to believe you're doing something nefarious. Care to correct it? A fair number of eyeballs hit this page. We wouldn't want people clicking on any malicious links.

Markdown linking gone wrong. It should be good now with just the link.

@df-a
Copy link

df-a commented Mar 3, 2021

@ jasonpaulmichaels

Hey everyone, total newbie here...

I just wiped a machine and did a complete reload of Catalina, updated all patches, etc. I then installed Xcode via the Appstore, rebooted, install Homebrew via terminal with the default Home-brew install command

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

and then ran this series of terminal commands to install FFMPEG w/ all options --

brew uninstall --force --ignore-dependencies ffmpeg
brew install chromaprint amiaopensource/amiaos/decklinksdk
brew tap homebrew-ffmpeg/ffmpeg
brew upgrade homebrew-ffmpeg/ffmpeg/ffmpeg $(brew options homebrew-ffmpeg/ffmpeg/ffmpeg | grep -vE '\s' | grep -- '--with-' | grep -vi chromaprint | tr '\n' ' ')

The only error I received was after running the last command which was --

Error: ffmpeg: An unsatisfied requirement failed this build.

I am uncertain if this is something I need to be worried about? Can anyone provide any information?

If anyone cares to look, the linked TXT file has the entire terminal cache on the commands entered and the results. I didn't want to post it in the thread for fear it wouldn't collapse and then you'd have to scroll through all of it.

And while I'm here, not to Hi-Jack, but as a part of FFMPEG and my workflow I need to install AppleVideoToolbox to activate hardware compression on this new iMac 27" -- can anyone comment on that?

Thank you!

If you compile it as I demonstrated above, here
https://gist.github.com/Piasy/b5dfd5c048eb69d1b91719988c0325d8#gistcomment-3314991

You should have videotoolbox working. The only config flag mentioning toolbox is "--disable-videotoolbox". To see which options are available to you, you can run "./configure --help" prior to compiling. The ones I included were for my specific use case scenario.

Again, Info MacOS here https://trac.ffmpeg.org/wiki/CompilationGuide/macOS

@phdoerfler
Copy link

I turned the instructions into a ruby script. You can set if you want chromaprint or not and it takes care of the rest.

#!/usr/bin/env ruby

def sys(cmd, *args, **kwargs)
  puts("\e[1m\e[33m#{cmd} #{args}\e[0m\e[22m")
  return system(cmd, *args, exception: true, **kwargs)
end

with_chromaprint = true

sys("brew", "uninstall", "--force", "--ignore-dependencies", "ffmpeg")
if with_chromaprint
  sys("brew", "install", "chromaprint", "amiaopensource/amiaos/decklinksdk")
end
sys("brew", "tap", "homebrew-ffmpeg/ffmpeg")
sys("brew", "install", "ffmpeg")
options = `brew options homebrew-ffmpeg/ffmpeg/ffmpeg`.split(/\n/).grep(/--with/)
unless with_chromaprint
  options = options.grep_v(/chromaprint/)
end
sys("brew", "upgrade", "homebrew-ffmpeg/ffmpeg/ffmpeg", *options)

@sarimarton
Copy link

None of the above worked for me... chromaprint is not found (even though brew installs it fine), ruby scripts fails with cryptic c++ errors etc.

@phdoerfler
Copy link

@sarimarton Interesting! What if you change with_chromaprintto false?

@sarimarton
Copy link

@phdoerfler Sorry, it might've been my mistake. It works now.

@newadventure079
Copy link

@phdoerfler

Here is what I get. I set with_chromaprint to false

#!/usr/bin/env ruby

def sys(cmd, *args, **kwargs)
  puts("\e[1m\e[33m#{cmd} #{args}\e[0m\e[22m")
  return system(cmd, *args, exception: true, **kwargs)
end

with_chromaprint = false

sys("brew", "uninstall", "--force", "--ignore-dependencies", "ffmpeg")
if with_chromaprint
  sys("brew", "install", "chromaprint", "amiaopensource/amiaos/decklinksdk")
end
sys("brew", "tap", "homebrew-ffmpeg/ffmpeg")
sys("brew", "install", "ffmpeg")
options = `brew options homebrew-ffmpeg/ffmpeg/ffmpeg`.split(/\n/).grep(/--with/)
unless with_chromaprint
  options = options.grep_v(/chromaprint/)
end
sys("brew", "upgrade", "homebrew-ffmpeg/ffmpeg/ffmpeg", *options)
ruby ./ffmpeg.rb
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/rbconfig.rb:230: warning: Insecure world writable dir /Users/me/Documents/code in PATH, mode 040777
brew ["uninstall", "--force", "--ignore-dependencies", "ffmpeg"]
Uninstalling ffmpeg... (271 files, 47.2MB)
brew ["tap", "homebrew-ffmpeg/ffmpeg"]
brew ["install", "ffmpeg"]
==> Downloading https://ghcr.io/v2/homebrew/core/ffmpeg/manifests/5.0.1_2
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/bb50c76a78f28f48015c22eea61b854d15f532a2c5469a83883a5afc6154c938--ffmpeg-5.0.1_2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/ffmpeg/blobs/sha256:b0ebc7d9cc49e85fc4c151989ce8f752aafae816a375d58797cc0169792bb1f2
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/f2b04c4430d1a7819c7e26c72ab218639229c276158c3074ee69bb4001388d57--ffmpeg--5.0.1_2.arm64_monterey.bottle.tar.gz
==> Pouring ffmpeg--5.0.1_2.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/ffmpeg/5.0.1_2: 272 files, 48.4MB
==> Running `brew cleanup ffmpeg`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
brew ["upgrade", "homebrew-ffmpeg/ffmpeg/ffmpeg", "--with-decklink", "--with-fdk-aac", "--with-game-music-emu", "--with-jack", "--with-libbluray", "--with-libbs2b", "--with-libcaca", "--with-libgsm", "--with-libmodplug", "--with-libopenmpt", "--with-librist", "--with-librsvg", "--with-libsoxr", "--with-libssh", "--with-libvidstab", "--with-libvmaf", "--with-libxml2", "--with-libzvbi", "--with-opencore-amr", "--with-openh264", "--with-openjpeg", "--with-openssl", "--with-openssl@1.1", "--with-rav1e", "--with-rtmpdump", "--with-rubberband", "--with-speex", "--with-srt", "--with-tesseract", "--with-two-lame", "--with-webp", "--with-xvid", "--with-zeromq", "--with-zimg"]
==> Upgrading 1 outdated package:
homebrew-ffmpeg/ffmpeg/ffmpeg 5.0.1_2 -> 5.0.1-with-options_2
==> Downloading https://ffmpeg.org/releases/ffmpeg-5.0.1.tar.xz
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/ecd25687ccfc53754bf7caf04090ae50038ba7de2ccd3405ddc91d5e0065bc48--ffmpeg-5.0.1.tar.xz
==> Upgrading homebrew-ffmpeg/ffmpeg/ffmpeg
  5.0.1_2 -> 5.0.1-with-options_2 --with-decklink --with-fdk-aac --with-game-music-emu --with-jack --with-libmodplug --with-libopenmpt --with-librist --with-librsvg --with-libsoxr --with-libssh --with-tesseract --with-libvidstab --with
==> ./configure --prefix=/opt/homebrew/Cellar/ffmpeg/5.0.1-with-options_2 --enable-shared --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libaom --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx
Last 15 lines from /Users/me/Library/Logs/Homebrew/ffmpeg/01.configure:
--extra-cflags=-I/opt/homebrew/include
--extra-ldflags=-L/opt/homebrew/include
--enable-libjack
--enable-indev=jack
--enable-version3
--enable-libopencore-amrnb
--enable-libopencore-amrwb

ERROR: zvbi-0.2 not found using pkg-config

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/homebrew-ffmpeg/homebrew-ffmpeg/issues

These open issues may also help:
Brewing custom ffmpeg but failure at metal execution https://github.com/homebrew-ffmpeg/homebrew-ffmpeg/issues/96

./ffmpeg.rb:5:in `system': Command failed with exit 1: brew (RuntimeError)
    from ./ffmpeg.rb:5:in `sys'
    from ./ffmpeg.rb:20:in `<main>'

@bdmorin
Copy link

bdmorin commented Mar 17, 2023

bdmorin@n0x ~> brew options ffmpeg
bdmorin@n0x ~> brew options homebrew-ffmpeg/ffmpeg/ffmpeg
Error: No available formula with the name "homebrew-ffmpeg/ffmpeg/ffmpeg".
Please tap it and then try again: brew tap homebrew-ffmpeg/ffmpeg
bdmorin@n0x ~ [1]> brew tap homebrew-ffmpeg/ffmpeg/ffmpeg
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
==> Updated Homebrew from d0c520210 to f09fcf45d.
....

Error: Invalid tap name 'homebrew-ffmpeg/ffmpeg/ffmpeg'

Does options no longer work?

@RadJKW
Copy link

RadJKW commented Apr 12, 2023

Found this gist while googling FFmpeg enable-chromaprint on macOS as of 04/2023.

Wanted to verify that with combining the solutions of @zoharbabin and @raedatoui. You can very easily install FFmpeg from home-brew with additional options.

Machine:
2021 M1 MacBook Pro 14inch (M1 Pro)

brew uninstall --force --ignore-dependencies ffmpeg
brew install chromaprint amiaopensource/amiaos/decklinksdk
brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-chromaprint

@cellulosa
Copy link

Did that work for you? I noticed that the built formula is under: /usr/local/Cellar/ffmpeg/6.0-with-options_1/bin/ffmpeg.

I noticed because if I run the command ffmpeg -muxers I do not see chromaprint, whereas if I point directly to /usr/local/Cellar/ffmpeg/6.0-with-options_1/bin/ffmpeg -muxers I can see it there.

@RadJKW
Copy link

RadJKW commented May 19, 2023

@cellulosa
If you are referring to my instructions, then yes this works.

Running the command ffmped -muxers shows E chromaprint Chormaprint.

I do not however have a folder at the location /usr/local/Cellar since I did not have to compile the build from source.

@cellulosa
Copy link

Cool, thanks! For some reason when I run these commands my main ffmpeg links to a non-build version (that is, without chromaprint) whereas the built version sits elsewhere. I am also discussing it here in case anybody else has the same issue.

@ChristianAndro
Copy link

Hi, anyone can help me ?, Im is Junior on linux os, and please help me How i can enable or adding the hardware accelerator nividia like hevc_nvenc, h264_nvenc and cuvid (cuda) or AMD vaapi, hevc_vaapi, h264_vaapi (amf, hevc_amf, h264_amf) on brew ffmpeg, now only support software encoding / decoding, But not support using hardware GPU for encoding and decoding , thanks for help

@sarimarton
Copy link

Use chatgpt

@ChristianAndro
Copy link

Use chatgpt

Thanks for your response, I have tried using chatgpt assistance, but it didn't work.

@EngHabu
Copy link

EngHabu commented Dec 3, 2023

@df-a thank you for the write up, super helpful!

One nit I would add:

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

to

git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg

to reduce downloaded artifacts from ~180mb to ~17mb

And I also had to update the .configure command to:

./configure  --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --enable-libxvid --enable-chromaprint --enable-libopenjpeg --enable-libaom --extra-ldflags=-L/opt/homebrew/lib --samples=fate-suite/ --extra-cflags=-I/opt/homebrew/include

To use homebrewed lame and other requirements. Otherwise I kept getting ERROR: libmp3lame >= 3.98.3 not found errors

@alexey-sh
Copy link

M1 chip

Error: invalid option: --with-chromaprint

2024 year and there is no way to install ffmpeg with all options

@Saafo
Copy link

Saafo commented Sep 26, 2024

M1 chip

Error: invalid option: --with-chromaprint

2024 year and there is no way to install ffmpeg with all options

@alexey-sh try this: https://stackoverflow.com/a/55108365/13724447

@gabrielstuff
Copy link

Unfortunately all of this is not valid anymore and you'll need to follow these steps if you just want all options, even ones that you will never use !

brew tap homebrew-ffmpeg/ffmpeg
brew install amiaopensource/amiaos/decklinksdk
brew tap lescanauxdiscrets/tap
brew install lescanauxdiscrets/tap/zvbi
brew install homebrew-ffmpeg/ffmpeg/ffmpeg $(brew options homebrew-ffmpeg/ffmpeg/ffmpeg | grep -vE '\s' | grep -- '--with-' | grep -vi libflite | tr '\n' ' ')`

The only lib I could not install was libflite :

Flite is a small fast run-time speech synthesis engine. It is the latest addition to the suite of free software synthesis tools including University of Edinburgh's Festival Speech Synthesis System and Carnegie Mellon University's FestVox project, tools, scripts and documentation for building synthetic voices. However, flite itself does not require either of these systems to run.

I guess, it will be next time !

Most of this operation can be found here: https://gist.github.com/Debdut/27a9b62a8f68534d39ae0c5d38591331?permalink_comment_id=5086936#gistcomment-5086936

Repo for ffmpeg with option: https://github.com/homebrew-ffmpeg/homebrew-ffmpeg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment