Skip to content

Instantly share code, notes, and snippets.

@clayton
Created August 9, 2013 18:55
Show Gist options
  • Save clayton/6196167 to your computer and use it in GitHub Desktop.
Save clayton/6196167 to your computer and use it in GitHub Desktop.
Install FFMPEG on OS X with HomeBrew to convert Mp4 to WebM
# Installation
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid
# Easy Peasy
ffmpeg -i video.mp4 video.webm
@congliu0704
Copy link

Revised version based on @florentroques's comment on Jul 12, 2018:

$ brew install ffmpeg $(brew options ffmpeg | grep -v -e '\s' | grep -e '--with-\|--HEAD' | tr '\n' ' ')

@CyberPunkCodes
Copy link

As of this post, the latest version of ffmpeg is 4.1.

I was getting errors about options being invalid. I tried some here, and the cool one liners, but none worked. I just did brew options ffmpeg, copied the results, and cleaned it up.

Here is the result for anyone who needs it and in the same boat:

brew install ffmpeg --with-aom \
--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-librsvg \
--with-libsoxr \
--with-libssh \
--with-libvidstab \
--with-libvmaf \
--with-opencore-amr \
--with-openh264 \
--with-openjpeg \
--with-openssl \
--with-rtmpdump \
--with-rubberband \
--with-speex \
--with-srt \
--with-tesseract \
--with-two-lame \
--with-wavpack \
--with-webp \
--with-zeromq \
--with-zimg

@robflynn
Copy link

robflynn commented Dec 15, 2018

Thanks, @WadeShuler. This worked for me. It did not work when issued as a reinstall, however. I didn't bother to investigate why, I most likely had an older version lying around conflicting with 4.1 as this specific system has been through many os updates. If you run into similar issues a clean install of the package should fix it.

@sakalauskas
Copy link

Looks like with Homebrew 2.0.3/ffmpeg 4.1.1 ffmpeg options are no longer available on the default tap.

I have followed guide on https://trac.ffmpeg.org/wiki/CompilationGuide/macOS Additional options to compile ffmpeg with additional options.:

brew tap varenc/ffmpeg
brew tap-pin varenc/ffmpeg
brew install ffmpeg $(brew options ffmpeg --compact)

@Benjamin-Connelly
Copy link

Looks like with Homebrew 2.0.3/ffmpeg 4.1.1 ffmpeg options are no longer available on the default tap.

I have followed guide on https://trac.ffmpeg.org/wiki/CompilationGuide/macOS Additional options to compile ffmpeg with additional options.:

brew tap varenc/ffmpeg
brew tap-pin varenc/ffmpeg
brew install ffmpeg $(brew options ffmpeg --compact)

smiling-face-with-heart-shaped-eyes_1f60d

@c0debreaker
Copy link

Help please - Error: invalid option: --with-libvidstab.
I've done brew install libvidstab and reinstalled ffmpeg, no good. Still same error.

@muschellij2
Copy link

Does brew install varenc/ffmpeg/ffmpeg $(brew options ffmpeg --compact) work now?

@neirinkp
Copy link

neirinkp commented Jun 7, 2019

^ "sakalauskas" approach from on Mar 5 seems to have worked for me on Mojave mac.

@edk
Copy link

edk commented Jun 21, 2019

:( not for me.

==> ./configure --prefix=/usr/local/Cellar/ffmpeg/4.1.3-with-options --enable-shared --enable-hardcoded-tables --cc=clang --host-cflags=-I/Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk/Contents/Home/include -I/Library
Last 15 lines from /Users/eddyk/Library/Logs/Homebrew/ffmpeg/01.configure:
--extra-ldflags=-L/usr/local/include
--enable-version3
--enable-libopencore-amrnb
--enable-libopencore-amrwb
--enable-libopenjpeg
--disable-decoder=jpeg2000
--extra-cflags=-I/usr/local/Cellar/openjpeg/2.3.1/include/openjpeg-2.3

ERROR: DeckLinkAPI.h not found

on mojave 10.14.5

@muschellij2
Copy link

muschellij2 commented Jun 21, 2019 via email

@ixna
Copy link

ixna commented Jun 25, 2019

Looks like with Homebrew 2.0.3/ffmpeg 4.1.1 ffmpeg options are no longer available on the default tap.

I have followed guide on https://trac.ffmpeg.org/wiki/CompilationGuide/macOS Additional options to compile ffmpeg with additional options.:

brew tap varenc/ffmpeg
brew tap-pin varenc/ffmpeg
brew install ffmpeg $(brew options ffmpeg --compact)

Thankyou, this one solved my problem, if you got an error probably its from dependency that not yet installed,
in my case, i'm missing decklink sdk (ERROR: DeckLinkAPI.h not found) so i go to install decklink sdk brew install amiaopensource/amiaos/decklinksdk and everything worked.

@jpalmieri
Copy link

jpalmieri commented Sep 5, 2019

https://github.com/varenc/homebrew-ffmpeg

⚠️ Note: This tap is currently not actively maintained. For an up-to-date tap, see homebrew-ffmpeg.

So, I installed using homebrew-ffmpeg, with the instructions there. I wanted to install all of the options, but decklink had an issue. I don't even know what decklink is, so I just copy/pasted the options output by brew options ffmpeg --compact and removed decklink.

https://github.com/homebrew-ffmpeg/homebrew-ffmpeg#installation-and-usage

brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-chromaprint /
--with-fdk-aac /
--with-game-music-emu /
--with-libbluray /
--with-libbs2b /
--with-libcaca /
--with-libgsm /
--with-libmodplug /
--with-librsvg /
--with-libsoxr /
--with-libssh /
--with-libvidstab /
--with-libvmaf /
--with-libxml2 /
--with-opencore-amr /
--with-openh264 /
--with-openjpeg /
--with-openssl /
--with-rtmpdump /
--with-rubberband /
--with-speex /
--with-srt /
--with-tesseract /
--with-two-lame /
--with-wavpack /
--with-webp /
--with-xvid /
--with-zeromq /
--with-zimg

EDIT: Oh, it looks like @ixna solved the decklink problem above by installing the deps, so you could do that first and the one liner should work. 🤷‍♂️

@benedictchen
Copy link

Doesn't seem to work now... Does this work?

brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-chromaprint --with-decklink --with-fdk-aac --with-game-music-emu --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-librsvg --with-libsoxr --with-libssh --with-libvidstab --with-libvmaf --with-libxml2 --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-rtmpdump --with-rubberband --with-speex --with-srt --with-tesseract --with-two-lame --with-wavpack --with-webp --with-xvid --with-zeromq --with-zimg```

@billyjf
Copy link

billyjf commented Mar 19, 2020

I got the following to work (comments from prior months did not work):

brew tap homebrew-ffmpeg/ffmpeg && brew install homebrew-ffmpeg/ffmpeg/ffmpeg && ffmpeg —help

@bfontaine
Copy link

bfontaine commented Mar 25, 2020

benedictchen’s command doesn’t work for me. I first got an error about a circular dependency that I fixed by temporarily commenting-out the line with ffmpeg in brew edit chromaprint; then I got an error about DeckLinkAPI.h that I fixed with brew install amiaopensource/amiaos/decklinksdk. Now ffmpeg is installed, but every time I run it I get this error:

$ ffmpeg --version
dyld: Library not loaded: @rpath/libclang_rt.ubsan_osx_dynamic.dylib
  Referenced from: /usr/local/opt/game-music-emu/lib/libgme.0.dylib
  Reason: image not found
Abort trap: 6

@brookjordan
Copy link

To be install ffmpeg as completely as possible without throwing errors, I eventually came to this:

brew install tesseract-lang && brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac --with-librsvg --with-libsoxr --with-libssh --with-tesseract --with-libvidstab --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-rubberband --with-webp --with-zeromq --with-zimg --with-srt --with-libvmaf --with-libxml2 --with-game-music-emu --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-openssl@1.1 --with-rtmpdump --with-speex --with-two-lame --with-wavpack --with-xvid

That is missing only two extensions: --with-chromaprint --with-decklink

@75th
Copy link

75th commented Apr 10, 2020

I get the same error as @bfontaine.

@bryancasler
Copy link

@brookjordan's command did the trick

To be install ffmpeg as completely as possible without throwing errors, I eventually came to this:

brew install tesseract-lang && brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac --with-librsvg --with-libsoxr --with-libssh --with-tesseract --with-libvidstab --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-rubberband --with-webp --with-zeromq --with-zimg --with-srt --with-libvmaf --with-libxml2 --with-game-music-emu --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-openssl@1.1 --with-rtmpdump --with-speex --with-two-lame --with-wavpack --with-xvid

That is missing only two extensions: --with-chromaprint --with-decklink

@onoakino
Copy link

onoakino commented May 8, 2020

@brookjordan's command did the trick

To be install ffmpeg as completely as possible without throwing errors, I eventually came to this:

brew install tesseract-lang && brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac --with-librsvg --with-libsoxr --with-libssh --with-tesseract --with-libvidstab --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-rubberband --with-webp --with-zeromq --with-zimg --with-srt --with-libvmaf --with-libxml2 --with-game-music-emu --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-openssl@1.1 --with-rtmpdump --with-speex --with-two-lame --with-wavpack --with-xvid

That is missing only two extensions: --with-chromaprint --with-decklink

Getting the same error as @bfontaine and @75th. I tried to remove --with-chromaprint and --with-decklink and it still

musangs-MacBook-Pro:~ musang$ ffmpeg
dyld: Library not loaded: @rpath/libclang_rt.ubsan_osx_dynamic.dylib
Referenced from: /usr/local/opt/game-music-emu/lib/libgme.0.dylib
Reason: image not found
Abort trap: 6
musangs-MacBook-Pro:~ musang$

@badola
Copy link

badola commented May 15, 2020

I needed ffmpeg for merging videos of youtube-dl.
The below-mentioned command did the required installation.
brew install homebrew-ffmpeg/ffmpeg/ffmpeg

@victorwads
Copy link

I needed ffmpeg for merging videos of youtube-dl.
The below-mentioned command did the required installation.
brew install homebrew-ffmpeg/ffmpeg/ffmpeg

Work for me

@anhnguyenkim-agilityio
Copy link

anhnguyenkim-agilityio commented Aug 20, 2020

brew install homebrew-ffmpeg/ffmpeg/ffmpeg
Work for me now on macOS Mojave Version 10.14.5

@YuCJ
Copy link

YuCJ commented Aug 26, 2020

OS: macOS 10.15.6

# Remove old ffmpeg
brew uninstall ffmpeg

# Install third party repository (it's v4.3.1 currently)
# If you need any extra decoder for the mp4 file, use --with-* flag 
# Ref: https://trac.ffmpeg.org/wiki/CompilationGuide/macOS#ffmpegthroughHomebrew
#      https://github.com/homebrew-ffmpeg/homebrew-ffmpeg#installing-with-options
brew install homebrew-ffmpeg/ffmpeg/ffmpeg

# Check if there are VP8, VP9 encoders
ffmpeg -encoders
# ...
#  V..... libvpx               libvpx VP8 (codec vp8)
#  V..... libvpx-vp9           libvpx VP9 (codec vp9)
# ...

# Convert with VP9
ffmpeg -i input.mp4 -c:v libvpx-vp9 output.webm
# Convert with VP8
ffmpeg -i input.mp4 -c:v libvpx output.webm

@patdiddy
Copy link

when I entered brew install ffmpeg under 10.15.7, it worked for me

@jdpierce21
Copy link

brew install ffmpeg worked for me

@ExpandingShapes
Copy link

brew install ffmpeg
works just fine

@welch
Copy link

welch commented May 16, 2022

On a fresh MacOS Monterey install, a simple brew install ffmpeg got me all the following:

ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100

@AtomicNess123
Copy link

I am getting

invalid option: --with-libass

I'm interested in libass. How to install it?
I'm on Mac.

@robflynn
Copy link

@AtomicNess123 When I installed ffmpeg recently via homebrew it came with libass already. Try just installing with brew install ffmpeg and then run ffmpeg by itself to see if: --enable-libass is int he output.

@AtomicNess123
Copy link

Thanks! I have the last version installed with brew: ffmpeg 5.1.2_1 is already installed and up-to-date.

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with clang version 4.0.1 (tags/RELEASE_401/final)
  configuration: --prefix=/opt/concourse/worker/volumes/live/d5b9ea1c-8223-4ff6-7416-83e6b4cd6874/volume/ffmpeg_1587154914508/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol --cc=x86_64-apple-darwin13.4.0-clang --disable-doc --enable-avresample --enable-gmp --enable-hardcoded-tables --enable-libfreetype --enable-libvpx --enable-pthreads --enable-libopus --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-static --enable-version3 --enable-zlib --enable-libmp3lame --disable-nonfree --enable-gpl --enable-gnutls --disable-openssl --enable-libopenh264 --enable-libx264

It doesn't seem libass is in the output.

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