EDIT: Found a way to get audio using Soundflower & sox.
EDIT 2: RTP+SDP was somehow garbling the output, new and improved script now uses FIFOs!
Turns out that livecasting your desktop in OS X is surprisingly hard. I found two ways online, none of which satisfied me, so I hunted for my own.
Adobe Flash Media Live Encoder, CamTwist & Soundflower
This method, described by Mike Chambers, relied on three separate GUI tools (one of which was required the Adobe Flash Media Live Encoder), consumed all my CPU, and refused to support my 16:10 aspect ratio. Yikes.
One simple app to do everything, but sadly it only supports streaming to Ucast, downscales to somewhere near the resolution of a feature-phone from 2000, and still constantly complains that I don’t have enough bandwidth. You can get the “Pro” version for $200 which gives you “HD Broadcasting” – but no thanks.
So, based on Tyler’s Linux approach, I tried getting something similar working on OS X. It only used ffmpeg, and seemed to work pretty well.
Surprisingly, my researched ended up with the following results:
ffmpeg doesn’t support screen grabbing on OS X
ffmpeg doesn’t have a single audio input that can read an audio device on OS X (see OpenAL section below)
ffmpeg can’t record a web cam on OS X (this would allow me to use CamTwist as an input source)
1. VLC doesn’t support streaming to an RTMP server
1. VLC can’t record from an audio device
1. The only other app that’d stream audio live from an audio device to a fifo or pipe was
Any of these statements might be wrong, so please tell me if you know a way :)
So, the best I could do was have VLC stream the screen over a FIFO to
ffmpeg, redirect audio through Soundflower, then use
sox to pipe audio to
ffmpeg recodes all that data and sends it to the justin.tv RTMP server. Not very simple, but at least it works.
Turns out that this works best if you do no work in VLC other than spew to a FIFO: no encoding or encapsulating. Even using MPEG-TS had issues in this context. Raw video in a dummy mux is passed over the FIFO to
ffmpeg is allowed to do all the encoding.
In any case, I figured I should share this with the rest of you.
Here’s a modified version of Tyler’s script:
ffmpeg can theoretically record input devices on OS X using OpenAL – which ships with OS X by default. I spent some time trying to get homebrew to build it (patch here), but when I finally got it building I realized it was completely broken. Yay!