How to start live streaming on Mac using FFMPEG?

Alexandra Chis picture Alexandra Chis · Oct 3, 2013 · Viewed 9.9k times · Source

I am working on a MAC OS X Lion 10.7.5.

How to properly install FFMPEG?

What I did:

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew install 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-schroedinger --with-speex --with-theora --with-tools

and even (I think this should work, but it doesn't)

brew install ffmpeg

Nothing works...I can't list the inputs, I can't start the streaming from the USB camera, I can't do anything.

ffmpeg -f video4linux2 -s 320x240 -i video="USB cam":audio="USB mic" -f oss -acodec libvorbis -vcodec libvpx -f webm http://localhost:1234/streaming

The errors I get look like this:

unknown input format 'video4linux'

and the same happens for alsa, openal, vfwcap etc.

So did anyone try live streaming with FFMPEG from MAC? How to install FFMPEG so that is supports video4linux2 or v4l2 or any input format at all? How to list the devices (USB webcams or integrated webcams)?

Answer

Richard Milewski picture Richard Milewski · Aug 3, 2014

You can gain access to the webcam in Mac OS with avfoundation.

To list the available input devices use:

ffmpeg -f avfoundation -list_devices true -i ""

An example that records the first device in the list to a file:

ffmpeg -f avfoundation -i "0" out.mpg