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
@jameslai

This comment has been minimized.

jameslai commented Mar 23, 2015

This may be out of date by now, because this didn't work for me, and included flags which are no longer supported (by homebrew for ffmpeg). Instead, I (successfully) used:

brew install ffmpeg --with-libvpx

Actually converting to a webm required flagging for experimental use, as the WebM codec will want to use Vorbis for audio by default (which is the right move for the best Firefox support, but ffmpeg will still shit itself). Therefore, to encode:

ffmpeg -i video.mp4 -strict -2 video.webm

@lucasmartins

This comment has been minimized.

lucasmartins commented Mar 23, 2015

Same here, just installed libvpx first:
brew install libvpx
brew install ffmpeg --with-libvpx

Thanks!

@chiglene

This comment has been minimized.

chiglene commented Apr 22, 2015

I know a way to convert MP4 to WebM without installing anything at: http://www.faasoft.com/articles/webm-converter.html

It also allows you to convert WebM to MP4, AVI, WMV, MOV, MKV, FLV, etc.

@hilezi

This comment has been minimized.

hilezi commented Jan 12, 2016

I did brew install ffmpeg without libvpx

So I do brew uninstall ffmpeg and then re-do install brew install ffmpeg --with-libvpx

It works!

ffmpeg -i video.mp4 -strict -2 video.webm

@keevee09

This comment has been minimized.

keevee09 commented Oct 12, 2016

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265

from:
trac.ffmpeg.org

@lacostenycoder

This comment has been minimized.

lacostenycoder commented Dec 1, 2016

brew install ffmpeg --with-libvpx works. FYI the make part takes a while, be patient.

==> make install /usr/local/Cellar/ffmpeg/3.2.1: 239 files, 51.7M, built in 6 minutes 39 seconds

@jeff-kilbride

This comment has been minimized.

jeff-kilbride commented Apr 12, 2017

Thanks for the pointer to the ffmpeg wiki! The install command seems a little out of date. Here's what I got:

Warning: ffmpeg: --with-ffplay was deprecated; using --with-sdl2 instead!
Warning: ffmpeg: this formula has no --with-libquvi option so it will be ignored!
==> Installing ffmpeg --with-fdk-aac --with-libass --with-sdl2 --with-x265 --with-freetype --with-libvorbis --with-libvpx --with-opus

Now, I am able to encode vp9 (webm).

@gawaineo

This comment has been minimized.

gawaineo commented Aug 1, 2017

Same here, just installed libvpx first:
brew install libvpx
brew install ffmpeg

Worked like a charm!

@ericwastaken

This comment has been minimized.

ericwastaken commented Oct 20, 2017

Confirmed. This worked for me on macOS Sierra:

brew install libvpx
brew install ffmpeg --with-libvpx

# result:
#   /usr/local/Cellar/ffmpeg/3.4: 248 files, 51.9MB, built in 8 minutes 18 seconds

Hm... after some experimenting, I came across: https://trac.ffmpeg.org/wiki/CompilationGuide/macOS

On there, the recommended homebrew install is:

brew install ffmpeg --with-fdk-aac --with-tools --with-freetype --with-libass --with-libvorbis --with-libvpx --with-x265

I found myself wanting to do some text overlays, and my first installation did not have freetype which the second command line does include in the compile!

For whatever it's worth to anyone else. :-)

@monajalal

This comment has been minimized.

monajalal commented Oct 31, 2017

How should I update my ffmpeg?

17:25:02 - bin - mona$ brew install ffmpeg
Warning: ffmpeg-3.1.1 already installed
Warning: You are using OS X 10.13.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.

@tschenkde

This comment has been minimized.

tschenkde commented Nov 4, 2017

@monajalal :
If you want to change the compile options for instance those pointed by @ericwastaken :
brew reinstall ffmpeg --with-fdk-aac --with-tools --with-freetype --with-libass --with-libvorbis --with-libvpx --with-x265
Since brew reinstall ffmpeg uninstalls ffmpeg first, it will take the same time to compile like a fresh install.
See: man brew

@hichetu

This comment has been minimized.

hichetu commented Nov 24, 2017

Warning: ffmpeg: --with-ffplay was deprecated; using --with-sdl2 instead!
Warning: ffmpeg: this formula has no --with-libquvi option so it will be ignored!

So the modified following works fine!:

brew install ffmpeg --with-fdk-aac --with-sdl2 --with-freetype --with-libass --with-libvorbis --with-libvpx --with-opus --with-x265

@DaveDave2013

This comment has been minimized.

DaveDave2013 commented Dec 3, 2017

Perfect!

@tedder

This comment has been minimized.

tedder commented Dec 12, 2017

if it's already installed:

brew install --force ffmpeg --with...
@Andrea47

This comment has been minimized.

Andrea47 commented Dec 22, 2017

it is easy

@sbgraves237

This comment has been minimized.

sbgraves237 commented Jan 3, 2018

I just got 'Error: Failed to download resource "yasm"' from "brew reinstall ffmpeg --with-libvpx" (in my user root directory "~" with ffmpeg version 3.1.1 installed under macOS 10.13.2).

This "brew reinstall" command was adapted from a suggestion by @tschenkde on Nov 4, 2017. The reinstall ran for over 7 minutes and printed not quite 50 lines of output before getting to this point.

I also tried "brew install --force ffmpeg --with-libvpx" suggeded by @tedder and got the same results as @monajalal.

I'm trying to convert mp4 to WebM using a command like "ffmpeg -i input.flv -vcodec libvpx -acodec libvorbis output.webm". This returned, "Unknown encoder 'libvpx'".

and the simpler "ffmpeg -i input.mp4 output.webm" returned, "Encoder (codec vp8) not found for output stream #0:0". Suggestions? Thanks, Spencer Graves

@RalphORama

This comment has been minimized.

RalphORama commented Feb 6, 2018

For people having issues with outdated flags, you can find the latest with flags in the ruby gem. As of posting, the full installation command is

brew install ffmpeg --with-chromaprint --with-fdk-aac --with-libass --with-librsvg --with-libsoxr --with-libssh --with-tesseract --with-libvidstab --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-rtmpdump --with-rubberband --with-sdl2 --with-snappy --with-tools --with-webp --with-x265 --with-xz --with-zeromq --with-zimg

@nsoui

This comment has been minimized.

nsoui commented Feb 10, 2018

Thank you @RalphORama. You saved me a lot of time

@donaldallen

This comment has been minimized.

donaldallen commented Mar 3, 2018

Another thanks to @RalphORama!

@requeijaum

This comment has been minimized.

requeijaum commented Mar 4, 2018

Will try it later... thanks, though!

@grahamannett

This comment has been minimized.

grahamannett commented Mar 21, 2018

@RalphORama thanks a ton, was looking to not have to copy and paste all those flags. Should really be a way to install with homebrew and have option to attach all the flags that won't create issues/conflicts with another.

@commshare

This comment has been minimized.

commshare commented Mar 24, 2018

thanks a lot !

@kenthinson

This comment has been minimized.

kenthinson commented May 22, 2018

@RalphORama you the man.

@jim-lake

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

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