52

when i run

ffmpeg -y -i test.mov -threads 8 -f webm -aspect 16:9 -vcodec libvpx -deinterlace -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -rc_buf_aggressivity 0.95 -vb 2M -acodec libvorbis -aq 90 -ac 2 OUTPUT_FILE.webm

it returns an error saying Unknown encoder 'libvpx'

I installed libvpx, libvorbis, libogg, and ffmpeg all via macports

Said Kaldybaev
  • 9,380
  • 8
  • 36
  • 53
Wiz
  • 4,595
  • 9
  • 34
  • 51

3 Answers3

129

Your configuration of macports was not built with libvpx. Try uninstalling ffmpeg and using Homebrew to install the package instead of macports:

brew install ffmpeg --with-libvpx

or

brew reinstall ffmpeg --with-libvpx

Then your command should work.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Yorb
  • 1,452
  • 1
  • 10
  • 8
  • 10
    I'm not sure why, but when I reinstall with only libvpx and libvorbis, I still got webm errors. However when I did all of these, it worked. Not sure which flag was the fix. `brew reinstall ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-speex --with-theora --with-tools` – bryan kennedy Nov 19 '14 at 19:27
  • 6
    `--with-libvorbis` is also needed. webm requires vorbis for audio compression. `--with-theora` can also be added to compiler options if you are having experimental encoder warnings from ffmpeg. – emrahgunduz Nov 23 '15 at 22:31
  • 3
    Not necessary with new ffmpeg in brew anymore! Just upgrade it: `brew upgrade ffmpeg` – lukyer Jan 19 '19 at 23:40
8

I'm not sure how and if it's possible to change the default configuration on Macports. Anyway, you can do it the manual way.

Open terminal and cd to your preferred directory. Before installing, check if, where and what version of ffmpeg you have install. Use which ffmpeg, then port uninstall ffmpeg and then which ffmpeg again to verify ffmpeg was uninstall properly.

Download the source code from:

git clone https://github.com/FFmpeg/FFmpeg ffmpeg

cd to the ffmpeg directory

cd ffmpeg

configure and make with your configuration, use "./configure --help" to get information regarding possible configuration

./configure --extra-cflags=-I/opt/local/include --extra-ldflags=-L/opt/local/lib --enable-gpl --enable-version3 --enable-nonfree --enable-libvpx --enable-libvorbis

I recommend adding the extra c/ld flags because /opt/local/ is the default macport install directory.

Make, install ffmpeg

make
sudo make install

There are a lot of fallbacks in these steps, ask in the comments if you have any issue.

EladG
  • 794
  • 9
  • 21
  • this is not a rant and +1 for your answer. But nowadays use homebrew. It makes your life so much easier! – awenkhh Nov 16 '14 at 20:12
  • 1
    true. I use homebrew myself for local development, yet for my production / deployment chef scripts, I still compile ffmpeg manually. – EladG Jun 19 '15 at 08:40
  • 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.freenode.net. Include the log file "config.log" produced by configure as this will help solve the problem. – Ganesh Shrivas Nov 09 '16 at 11:48
  • make sense. this answer was given 4 years ago, follow `./configure --help` for compiling assistance or use a package builder like homebrew – EladG Nov 09 '16 at 23:20
1

Due to all the dependencies building ffmpeg from source is a nightmare on OS X. It will take you days to get it to build properly.

Don't bother.

Instead just download the static binary from https://www.ffmpeg.org/download.html and copy it into /usr/local/bin

wmil
  • 3,179
  • 2
  • 21
  • 24
  • Be sure to hover over the Apple logo to have the page show the OSX downloads (I didn't know this when I fist went on the page). – ZomoXYZ May 03 '16 at 17:49
  • 3
    Builds seamlessly through homebrew with options `--with-libvpx` and `--with-libvorbis`. Took about 5 minutes. – david cako Apr 05 '17 at 03:16