Having trouble setting up mediastreamsegmenter on Mac OS X 10.6

jeffehobbs picture jeffehobbs · Oct 2, 2010 · Viewed 7.3k times · Source

I'm trying to use Mac OS X 10.6's mediastreamsegmenter to take the audio input of my mac and turn it into a stream that I could listen to on the iPhone.

I've read this and the related man page. But when I do something like this:

mediastreamsegmenter -s 3 -D -f /tmp/stream localhost:8080

No files appear in the 'stream' directory and when I try and use QuickTime Player X to connect to localhost:8080, no go.

What am I missing here?

Answer

martineno picture martineno · Dec 8, 2010

According to the tech note that describes the mediastreamsegmenter tool:

This tool receives an MPEG-2 transport stream over a UDP network connection or from stdin and divides it into a series of small media segments of equal duration. It then creates an index file containing references to the individual media segments.

This means that you will need to have a UDP server running on the machine that you want to do the capture on, that is capable of pushing out the data in a MPEG2 transport stream.

I wasn't able to find anything freely available that captures from a mic input, but here is a series of steps to see a working live streaming that will stream from your iSight.

Before you start, you will need the latest version of VLC.

Setup Streaming Server

  1. Start VLC and select File -> Open Capture Device...
  2. Select the Capture tab and choose iSight in the dropdown
  3. Make sure the Streaming/Saving checkbox is enabled
  4. Click the Setting... button and configure as in the screencap below: alt text
  5. Click OK, but don't click the Open button just yet
  6. Go to System Preferences, click on the Sharing icon and make sure Web Sharing is turned on.
  7. Go to your home folder and in the Sites folder create a new folder called for example streaming
  8. In Terminal type mediastreamsegmenter -s 3 -D -f /Users/your-user-name/Sites/stream/ 127.0.0.1:2222 and press enter. Make sure to replace your-user-name with your short user name. If you don't know what that is, type whoami in the Terminal
  9. In VLC click Open

If all goes well after a few seconds you should see messages like this:

Dec  7 2010 22:46:37.696: Finalized /Users/name/Sites/stream/fileSequence27.ts
Dec  7 2010 22:46:37.741: received 276360 written bytes 260380 skipped 15792 pat/pmt skipped 15792
Dec  7 2010 22:46:48.504: Finalized /Users/name/Sites/stream/fileSequence28.ts
Dec  7 2010 22:46:49.263: received 371112 written bytes 356636 skipped 15792 pat/pmt skipped 15792

Stream

To test that everything is working:

  1. Open QuickTime X
  2. File -> Open URL
  3. Type in http://localhost/~name/stream/prog_index.m3u8
  4. Click Open

On an iPhone just open MobileSafari and go to the the same URL, e.g. http://your.ip.address/~name/stream/prog_index.m3u8