How to install libav/avconv on Mac OS X or macOS 11?

Just install it with brew:

brew install libav

First grab the library:

 wget http://libav.org/releases/libav-10.1.tar.gz
# use http://libav.org/releases/libav-snapshot.tar.bz2 for the latest snapshot
tar -xvzf libav-10.1.tar.gz 
cd libav-10.1

Set up the dependencies with MacPorts (or other package managers such as Homebrew):

sudo port install yasm zlib bzip2 faac lame speex libogg libvorbis libtheora libvpx x264 XviD openjpeg15 opencore-amr freetype

Build libav:

./configure \
--extra-cflags=-I/opt/local/include --extra-ldflags=-L/opt/local/lib \
--enable-gpl --enable-libx264 --enable-libxvid \
--enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb \
--enable-nonfree --enable-libfaac \
--enable-libmp3lame --enable-libspeex --enable-libvorbis --enable-libtheora --enable-libvpx \
--enable-libopenjpeg --enable-libfreetype --enable-doc --enable-gnutls --enable-shared

make && sudo make install

Then you can run avconv:

avconv -i input.avi -c:v libx264 -preset slow -crf 18 output.mp4

  • x264 +asm seems to be required to get working cpu-capabilities, so if you don't get them (ie. [libx264 @ 0x7fe66101a800] using cpu capabilities: none!) run:

sudo port upgrade --enforce-variants x264 +asm

You should get sth like: [libx264 @ 0x7fc62401b600] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX

Tags:

Macos

Libav