Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@kenthinson
Copy link

kenthinson commented May 22, 2018

@RalphORama you the man.

@jim-lake
Copy link

jim-lake commented May 24, 2018

This is actually the command i used to get everything
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-librsvg --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

@florentroques
Copy link

florentroques commented Jul 12, 2018

Simpler command to install ffmpeg with all options so no problems anymore

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

source: https://gist.github.com/Piasy/b5dfd5c048eb69d1b91719988c0325d8#gistcomment-2571754

@congliu0704
Copy link

congliu0704 commented Sep 18, 2018

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' ' ')

@WadeShuler
Copy link

WadeShuler commented Dec 5, 2018

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

sakalauskas commented Mar 5, 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)

@Benjamin-Connelly
Copy link

Benjamin-Connelly commented Mar 22, 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)

smiling-face-with-heart-shaped-eyes_1f60d

@c0debreaker
Copy link

c0debreaker commented Apr 1, 2019

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

@muschellij2
Copy link

muschellij2 commented May 17, 2019

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

@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

benedictchen commented Dec 25, 2019

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

brookjordan commented Mar 28, 2020

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

bryancasler commented May 4, 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

@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

victorwads commented Jul 3, 2020

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

@anhnguyen-agilityio
Copy link

anhnguyen-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

patdiddy commented Dec 16, 2020

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

@jdpierce21
Copy link

jdpierce21 commented Jan 19, 2022

brew install ffmpeg worked for me

@ExpandingShapes
Copy link

ExpandingShapes commented Jan 26, 2022

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

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