Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create your own live MP3 streaming server UNIX
It is now possible to do Live audio streaming to an icecast server from Mac OS X. Under Mac OS 9, there was SoundJam, but under Mac OS X, I didn't find any software to do live streaming. The solution is to use some UNIX open source projects. Read the rest of the article for the details (the Developer Tools are required to compile some of the required UNIX code)...

  1. The following open source programs are required:


  2. Compile & install everything first, then go to the libshout example application directory, compile it with you server IP address and password, and add the mount point:
    conn.ip = "xx.xx.xx.xx";
    conn.port = 8000;
    conn.password = "hackme";
    conn.mount = "test";
    conn.bitrate = 128;
  3. Start a terminal session and enter esd; this will grab your default sound input.

  4. Start a new terminal session and start the icecast server.

  5. Start a new terminal session, go to the example directory of libshout and enter at the prompt:
      % esdrec | lame -b 128 - - | ./example
    This will grab your sound-in (I've tested Mic and Sound-In on a new PB 800 MHz), pipe it to the MP3 encoder, and send it to the icecast server with "example".

  6. Open iTunes and in Advanced -> Open Stream, enter the URL as:
    http://xx.xx.xx.xx:8000/test
    And hear the stream, quality is perfect and in total it uses less then 30 % CPU power for encoding.
[Editor's note: I have not tested this myself, but intend to now that our cable modem upload speeds have been doubled!]
    •    
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[33,596 views]  

Create your own live MP3 streaming server | 19 comments | Create New Account
Click here to return to the 'Create your own live MP3 streaming server' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
More info?
Authored by: vonleigh on Jul 04, '02 05:25:32PM

Hello,

The instructions are kinda hammered out, lots of things are assumed. I barely got to step two before I got stuck. I downloaded and compiled everything, but then when you say:

\"compile it with you server IP address and password, and add the mount point:\"

I have no idea what you mean.


Vonleigh



[ Reply to This | # ]
More info?
Authored by: yvesvdb on Jul 05, '02 06:20:07AM

I admit that the notes are a bear minimum, but I'm leaving on vacation, and I only did get it working yesterday so thats why.

OK if you have compilled and installed the packages in step 1, you still need to compile one example application which resides in the libshout/example directory and it is called example. The file itself is called example.c an looks like this :

#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <shout/shout.h>

int main()

{
shout_conn_t conn;
char buff[4096];
long read, ret, total;
shout_init_connection(&conn);
conn.ip = "127.0.0.1";
conn.port = 8000;
conn.password = "letmein";
...


Modify the part conn.ip, port password like:

conn.ip = "xx.xx.xx.xx"; <- give the IP address of your icecast server !!!
conn.port = 8000;
conn.password = "hackme"; <- give the password of your icecast server !!!
conn.mount = "test"; <- this is the mount point
conn.bitrate = 128; <- bitrate of the stream

save the file and type
# make
(be sure you are in the example directory)
now follow the other steps and you should be ok


remark about setting up the icecast server, the easiest thing to do this is that you rename or copy the example configuration file which is located /usr/local/icecast/conf/icecast.conf.dist to icecast.conf in that same directory ... this way the server will work but mountpoints will not work, if you are doing one stream live stream to it it doesn't matter because it defaults to the first one ... I know this is again a weak explanation ... but setting up an icecast server is not the topic here ...

I'm leaving know on vacation, I`ll be back on the 23th ...

Agian I know that the explanation is not that great but believe me it is the only LIVE MP3 streaming solution under Mac OS X I know of.

Yves.



[ Reply to This | # ]
More info?
Authored by: vonleigh on Jul 05, '02 05:16:52PM

Hello,

Thanks for the info. I had also been looking for a _live_ streaming solution for a while. I appreciate you sharing the info, sorry if last message seemed a bit terse, was a bit frustrated.

Anyway, I've followed your directions but for some reason the source (libshout) is not connecting to the icecast server. I don't get an error or anything, it just says:

% esdrec | lame -b 128 - - | ./example
opening socket, format = 0x00002021 at 44100 Hz
Connected to server...

In my other terminal window I have:

[Bandwidth: 0.000000MB/s] [Sources: 0] [Clients: 0] [Admins: 1] [Uptime: 4 minutes and 1 seconds]

The odd thing is that if I close my encoder (^C for lack of knowing a better way of doing it), I get this in the server:

-> [05/Jul/2002:14:16:26] Accepted encoder on mountpoint /test from mydomain.net. 1 sources connected
-> [05/Jul/2002:14:16:26] Lost connection to source on mount /test, waiting 30 seconds for timeout

So I guess it does know it's there, but only when I close it, quite odd.

Have a great vacation :)


Vonleigh



[ Reply to This | # ]
More info?
Authored by: dkheger on Aug 13, '02 12:15:59PM
Hey!
I had the same problem. I found out that if I don't start esd (in step 3 of the instuctions) it fixes the problem.

Now the problem that I have is that I can't figure out how to change the default built-in mircophone input to the microphone (line-in) input.

Any ideas?

thanks!

Dal.
A UNIX (OS X) newbie.


[ Reply to This | # ]
More info?
Authored by: tmerritt on Aug 15, '02 04:38:01PM

I think you need to have a source plugged in to the line in for it to show up in the selection dialog.

Where can a rank CLI newbie find some help for installing the apps at the start of this thread? Compiling things, using fink... where can I find a friendly how-to? I use Final Cut Pro and QuickTime authoring stuff all the time, but I would like help getting started with the command line. If I could stream MP3 audio on my network, record in MP3 format the audio direct from my internal PowerBook mic... these are tools I could use and maybe a good introduction to this aspect of OS X.



[ Reply to This | # ]
QT Broadcaster
Authored by: JohnnyMnemonic on Jul 04, '02 07:08:01PM
Um, why not use QT Broadcaster? Although it does require QTSS for mulitple simultaneous streams, I would think that that it's easier to get QTSS running on OS X client (for free!) than using the above hint. And it does one-to-one streaming with no additional software (besides QT for Windows, if you're not streaming to another Mac.)

[ Reply to This | # ]
QT Broadcaster
Authored by: Chas on Jul 04, '02 11:16:32PM

Yes indeed, I've setup QT Broadcaster and it works like a charm streaming live video and audio. QTSS4 is a wonderful piece of software, and the new QT6 Preview + QTB makes it possible to do live streaming from QTSS4 even to QT5 users (just make sure not to use the mpg4 codecs which are QT6 only).



[ Reply to This | # ]
QT Broadcaster
Authored by: yvesvdb on Jul 05, '02 05:52:33AM

It doesn't do MP3 streaming, and the clients need to have QT Installed ..., even iTunes is not able to tune into a QTB stream



[ Reply to This | # ]
Take streaming to the next level
Authored by: johnmont on Jul 05, '02 12:18:30AM

If you want to take this to the next level, a real cool program to install is Andromeda. You'll need to have your web server running and fork out a little change. But it is waaaaay cool.

http://www.turnstyle.com/andromeda/features.asp



[ Reply to This | # ]
Take streaming to the next level
Authored by: bluehz on Jul 05, '02 01:15:25AM

Better than Andromeda - Netjukebox

http://netjukebox.sourceforge.com



[ Reply to This | # ]
Take streaming to the next level
Authored by: ssevenup on Sep 09, '02 03:42:28AM

Netjuke is cool, and I have it running on a Linux box along with about 200 Ogg Vorbis CD titles. The problem is that the streams open with iTunes. The only way to get them to open in XMMS under XFree86 is to have XMMS open the resultant *.m3u playlist files directly. There seems to be no way to assign XMMS as the "helper" so they open in XMMS directly. I would also like the m3u files to be written to a temp folder that gets cleaned by cron at night or on reboot, but that's secondary to the larger issue. Mozilla will let me select XMMS as the helper app (unlike IE), but an error results when Mozilla tries to call XMMS to play them (even if it's already running).

--MM



[ Reply to This | # ]
Take streaming to the next level
Authored by: yvesvdb on Jul 05, '02 05:55:17AM

It doesn't do LIVE streaming, so if you are a real radio station, you can not use these solutions. The solutions mentioned here only work when you aleady have the mp3 files



[ Reply to This | # ]
MP3Streamer
Authored by: bigl00z3 on Jul 05, '02 02:11:29AM

http://www.maliasoft.com/index_e.html MP3 Streamer
Maybe this can work if you don't want to go in the terminal. (I haven't tried it, so I don't know if it's good bad working or not... just saw it on a web site)
b!gl00z3



[ Reply to This | # ]
MP3Streamer
Authored by: yvesvdb on Jul 05, '02 06:54:11AM

Cool app but doesn't do live streaming.

Yves.



[ Reply to This | # ]
Extra info + Bonus
Authored by: yvesvdb on Jul 05, '02 09:17:36AM

Hi,
just discovered that you can encode multiple bit rates and run the whole proces as deamons in the background at the terminal you can do:
# esdrec | lame -b 128 - - | ./example &
to start a second encoding
# esdrec | lame -b 56 - - | ./example &
be aware that you first have to compile example app with an other mount point otherwise you will send both encodings to the same point,or you could also stream it to a second icecast server if you whish!

If you dont want to stream your imput but just write it down as an MP3 file do
# esdrec | lame -b 128 - ~/Desktop/liverec.mp3
output that you will see is something like this ...
Assuming raw pcm input file
LAME version 3.91 (http://www.mp3dev.org/)
Using polyphase lowpass filter, transition band: 15115 Hz - 15648 Hz
Encoding <stdin> to /Users/yves/Desktop/liverec.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=5

You can stop the recording by pressing ctrl - c
The file you get can be played in iTunes ...

Sound inputs that I've tested are Powerbook Mic and sound in port on the Titanium 800 MHz

Yves.



[ Reply to This | # ]
Other tools
Authored by: oculos on Jul 05, '02 06:45:29PM

There are also other tools that performs MP3 streaming.

First, there's a Shoutcast server, that performs mostly like the Icecast one.

Second, there's MaltX (Macamp Light X), which works wonderfully for mp3 streams. It's compatible with Shoutcast, Icecast and Live365, also.



[ Reply to This | # ]
Have you tried multicast?
Authored by: tz on Jul 06, '02 12:58:09AM

Use an IP address from 224.0.0.0-239.255.255.255 or something like that - QT broadcaster picks one automatically, you may want to use something in the middle.

If you send on 225.1.2.3, you should be able to receive on any computer on your local network (or you need mrouted).



[ Reply to This | # ]
Create your own live MP3 streaming server
Authored by: dwipal on Dec 30, '04 09:08:32PM

I managed to compile everything (Icecast 2.2.0, libshout2, etc).

To compile icecast, i had to use "fakepoll.h" header file from sealiesoftware.com/fakepoll.h to get around with the poll.h errors.

The icecast server starts fine, libshout example file connects to the server, but it seems to be dropping the stream somewhere. I am basically not able to play the stream.

Dumping the output of lame to a file and playing it back again is working, so there is something with icecast.

Any suggestions ?

Below is the icecast error_log file:

[2004-12-30 18:02:00] INFO main/main Icecast 2.2.0 server started
[2004-12-30 18:02:00] WARN main/main YP server handling has been disabled
[2004-12-30 18:02:00] INFO stats/_stats_thread stats thread started
[2004-12-30 18:02:00] INFO fserve/fserv_thread_function file serving thread started
[2004-12-30 18:02:01] DBUG slave/_slave_thread checking master stream list
[2004-12-30 18:02:13] INFO connection/_handle_source_request Source logging in at mountpoint "/radio.mp3"
[2004-12-30 18:02:13] DBUG connection/connection_complete_source sources count is 0
[2004-12-30 18:02:13] DBUG connection/connection_complete_source source is ready to start
[2004-12-30 18:02:13] DBUG source/source_init Source creation complete
[2004-12-30 18:02:13] DBUG stats/modify_node_event update node connections (1)
[2004-12-30 18:02:13] DBUG stats/modify_node_event update node source_client_connections (1)
[2004-12-30 18:02:13] DBUG stats/process_source_event new source stat /radio.mp3
[2004-12-30 18:02:13] DBUG stats/process_source_event new node public (0)
[2004-12-30 18:02:13] DBUG stats/process_source_event new node listenurl (http://192.168.2.10:8000/radio.mp3)
[2004-12-30 18:02:13] DBUG stats/modify_node_event update node sources (1)
[2004-12-30 18:02:13] DBUG stats/modify_node_event update node source_total_connections (1)
[2004-12-30 18:02:13] DBUG stats/process_source_event new node listeners (0)
[2004-12-30 18:02:13] DBUG stats/process_source_event new node server_name (no name)
[2004-12-30 18:02:22] DBUG connection/_handle_get_request Source found for client
[2004-12-30 18:02:22] DBUG source/source_main Client added
[2004-12-30 18:02:22] INFO source/source_main listener count on /radio.mp3 now 1
[2004-12-30 18:02:22] DBUG stats/modify_node_event update node connections (2)
[2004-12-30 18:02:22] DBUG stats/modify_node_event update node client_connections (1)
[2004-12-30 18:02:22] DBUG stats/modify_node_event update node clients (1)
[2004-12-30 18:02:22] DBUG stats/modify_node_event update node listeners (1)
[2004-12-30 18:02:24] DBUG source/get_next_buffer last 1104458533, timeout 10, now 1104458544
[2004-12-30 18:02:24] WARN source/get_next_buffer Disconnecting source due to socket timeout
[2004-12-30 18:02:24] INFO source/source_shutdown Source "/radio.mp3" exiting
[2004-12-30 18:02:24] DBUG source/source_clear_source clearing source "/radio.mp3"
[2004-12-30 18:02:24] DBUG format-ogg/format_ogg_free_headers releasing header pages
[2004-12-30 18:02:24] DBUG format-ogg/free_ogg_codecs freeing codecs
[2004-12-30 18:02:24] DBUG source/source_free_source freeing source "/radio.mp3"
[2004-12-30 18:02:24] DBUG stats/modify_node_event update node sources (0)
[2004-12-30 18:02:24] DBUG stats/process_source_event delete source node /radio.mp3
[2004-12-30 18:02:24] DBUG stats/modify_node_event update node clients (0)

Thanks !
Dwipal



[ Reply to This | # ]
ESD + USB audio
Authored by: heyheyitsbrent on Dec 12, '06 05:56:56PM

Does anyone have any experience using ESD to capture sound from an external usb audio interface? ESD simply returns unsupported device. Are there any alternatives, apart from plugging the headphone out on the interface into my computer's line in?
The interface I am using (Lexicon Omega) works well for recording various inputs using digital preformer and various other audio software.
I've tried using JACK, but ESD still says it is unsupported.
The ESD documentation is useless.

Thanks
Brent



[ Reply to This | # ]