Skip to content

Instantly share code, notes, and snippets.

@Piasy
Last active April 14, 2024 05:40
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
@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

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