Create a gist now

Instantly share code, notes, and snippets.

Embed
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.

Show comment
Hide comment
@jameslai

jameslai 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

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.

Show comment
Hide comment
@lucasmartins

lucasmartins Mar 23, 2015

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

Thanks!

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

Thanks!

@chiglene

This comment has been minimized.

Show comment
Hide comment
@chiglene

chiglene 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.

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.

@Pleasurazy

This comment has been minimized.

Show comment
Hide comment
@Pleasurazy

Pleasurazy 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

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.

Show comment
Hide comment
@keevee09

keevee09 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

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.

Show comment
Hide comment
@lacostenycoder

lacostenycoder 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

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.

Show comment
Hide comment
@jeff-kilbride

jeff-kilbride 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).

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.

Show comment
Hide comment
@gawaineo

gawaineo Aug 1, 2017

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

Worked like a charm!

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.

Show comment
Hide comment
@ericwastaken

ericwastaken 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. :-)

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.

Show comment
Hide comment
@monajalal

monajalal 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.

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.

Show comment
Hide comment
@tschenkde

tschenkde 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

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.

Show comment
Hide comment
@hichetu

hichetu 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

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.

Show comment
Hide comment
@DaveDave2013

DaveDave2013 Dec 3, 2017

Perfect!

Perfect!

@tedder

This comment has been minimized.

Show comment
Hide comment
@tedder

tedder Dec 12, 2017

if it's already installed:

brew install --force ffmpeg --with...

tedder commented Dec 12, 2017

if it's already installed:

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

This comment has been minimized.

Show comment
Hide comment
@Andrea47

Andrea47 Dec 22, 2017

it is easy

it is easy

@sbgraves237

This comment has been minimized.

Show comment
Hide comment
@sbgraves237

sbgraves237 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

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.

Show comment
Hide comment
@RalphORama

RalphORama 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

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.

Show comment
Hide comment
@nsoui

nsoui Feb 10, 2018

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

nsoui commented Feb 10, 2018

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

@donaldallen

This comment has been minimized.

Show comment
Hide comment
@donaldallen

donaldallen Mar 3, 2018

Another thanks to @RalphORama!

Another thanks to @RalphORama!

@requeijaum

This comment has been minimized.

Show comment
Hide comment
@requeijaum

requeijaum Mar 4, 2018

Will try it later... thanks, though!

Will try it later... thanks, though!

@grahamannett

This comment has been minimized.

Show comment
Hide comment
@grahamannett

grahamannett 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.

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

Show comment
Hide comment
@commshare

commshare Mar 24, 2018

thanks a lot !

thanks a lot !

@kenthinson

This comment has been minimized.

Show comment
Hide comment
@kenthinson

kenthinson May 22, 2018

@RalphORama you the man.

@RalphORama you the man.

@jim-lake

This comment has been minimized.

Show comment
Hide comment
@jim-lake

jim-lake 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

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

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