OSX comes with a command line video conversion utility avconvert but this tool provides limited functionality compared to the avconv provided by libav.

How can I install avconv on OS X (or macOS 11)?

  • 6
    With Homebrew: brew install libav. Commented Jun 16, 2015 at 11:00
  • 1
    now: libav has been disabled because it is not maintained upstream! Commented Jan 5, 2023 at 13:31

4 Answers 4


Just install it with brew:

brew install libav
  • 2
    Ugh, why brew install avconv doesn't work is beyond me. Commented Dec 6, 2020 at 9:23

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

  • 3
    On Mac OSX, dependencies installed via MacPorts and using pkg-config are not found until you set environment variable export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig'. Also, for the fun of it, you may add, to ./configure, options: --extra-cflags=-I/opt/local/include --extra-ldflags=-L/opt/local/lib. Then the whole ./configure` above miraculously passes!
    – Alexy
    Commented Jul 16, 2013 at 17:30
  • 6
    brew install libav Commented May 24, 2014 at 19:18
  • 1
    On the second to last step, build lib-av. ERROR: gnutls not found Commented Aug 2, 2014 at 3:41
  • @ChaseRoberts Hi Chase, i also have the same problem with gnutls not found. I tried following a guide gist.github.com/morgant/1753095 but encountered more errors. Were you ever able to get things to work? Commented Dec 31, 2014 at 22:53
  • ok I just had to re-install homebrew in order to get brew install libav to work. Commented Dec 31, 2014 at 23:11

For those without brew - and until macports come up with a port for libav, here are my notes for installing libav on OSX 10.8.5 from source (libav version 12_dev0, from github).

The main problem I faced was that libav uses sem_timedwait() (semaphore.h in linux) which is not defined in macos.

This post https://stackoverflow.com/a/15163760 mentions that Keith Shortridge of the Australian Astronomical Observatory's software group (thanks) have written an implementation of said function for macos which can be found here https://github.com/attie/libxbee3/tree/master/xsys_darwin

Download the two files into ${LIBAVDIR}/libavdevice and then add the following line in the header file sem_timedwait.h:

int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout);

Then edit the Makefile in ${LIBAVDIR}/libavdevice and add sem_timedwait.o at the end of the OBJS variable

configure and make all

you are good to go.

for the record, I used the following configure command:

./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 --prefix=/opt/local

WARNING: I can not say or guarantee whether the said implementation of sem_timedwait() is the correct one and/or will have no side-effects to the working of libav or indeed any other part of the system which links to libav libraries which have now a sem_timedwait() implementation in there!!!! For the latter may I suggest renaming sem_timedwait() everywhere in your copy of libav and Keith's implementation. Also check if any other symbols are exported from sem_timedwait.o and rename them also.

Here are the new, renamed symbols from Keith Shortridge's implementation of sem_timedwait():

sem_timedwait_keith, timeoutThreadMain_keith, triggerSignal_keith, ignoreSignal_keith, timeoutThreadCleanup_keith

(remove _keith to get the original names). The only reference to sem_timedwait() in libav (for said version) is in jack.c.


For videos hosted on https (many, these days), make sure you build avconv with OpenSSL support:

brew install libav --with-openssl

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .