A streaming server allows you to transmit MP3 files over a TCP based network. This can be the Internet itself or your local network / intranet.
The connection principal is very similar to that of a web server, files are streamed when a client (the MP3 player) connects to the server.
Setting-up a streaming server is reasonably straight forward, I'll focus on Icecast first, then Fluid.
After downloading and untaring, a good look around the doc/ directory would be a good thing, the HTML manual is very helpful and comprehensive.
If you have downloaded the source code, follow the instructions regarding compiling pertinent to your system.
Icecast will not work correctly unless you correctly set the servername in the config file, icecast.conf, which is located in the etc directory. It must match the name that resolves to your IP address.
If you see the following line when Icecast starts-up you have problems:
-> [05/Jan/2000:17:21:04] WARNING: Resolving the server name [your.server.name] does not work!
Edit icecast.conf which is located in the etc directory and locate the line containing the entry for "server_name" and enter your servers name. If you are unsure you can find out by using the hostname command, or by cat'ing /etc/hosts.
Once you've made the neccesary changes you'll need to either copy the conf file to the bin directory, or start icecast with the -c option and specify the location, like so:
./icecast -c ../etc/icecast.conf
If everything has been configured correctly, you should see something similar to the following:
[dj@megajukebox bin]$ ./icecast -c ../etc/icecast.conf -d /home/dj/mp3/icecast/ Icecast Version 1.3.0 Starting... Icecast comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of Icecast under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING. [05/Jan/2000:18:36:30] Icecast Version 1.3.0 Starting.. [05/Jan/2000:18:36:30] Using stdin as icecast operator console [05/Jan/2000:18:36:30] Tailing file to icecast operator console [05/Jan/2000:18:36:30] Server started... [05/Jan/2000:18:36:30] Listening on port 8000... [05/Jan/2000:18:36:30] Using [megajukebox] as servername... [05/Jan/2000:18:36:30] Max values: 1000 clients, 1000 clients per source, 10 sources, 5 admins -> [05/Jan/2000:18:36:30] [Bandwidth: 0.000000MB/s] [Sources: 0] [Clients: 0] [Admins: 1] [Uptime: 0 seconds]
The -d option sets the directory for log files and templates.
Below is the list of command-line options:
-c [filename] Parse as a configuration file. Please note that any command line parameters you supply after this override whatever is in file. Also note that icecast.conf in the current directory is already parsed when you specify this file, so anything in icecast.conf not overridden by the new configuration file will be used by the server. -P [port] This is the port used for all client, source, and admin connections. It's set to 8000 by default. -m [max clients] Allow this number of client connections. When this number is reached, all client connections will be refused with 'HTTP/1.0 504 Server Full' -p [encoder password] This sets the password that the encoder must use to be allowed to stream to the server. Note that if you have compiled the server with crypt() support, this argument must be an encrypted string. -b This will send the icecast server into the background (i.e daemon process). To use the admin commands now, you have to connect to the server as an admin, using some sort of telnet client. -d [directory] Make all log files created by icecast, and all templates that icecast looks for be relative to this directory.
So, thats the server started, but you now need to connect an MP3 source to the server.
Shout provides Icecast with a static playlist of MP3's to stream.
You create the playlist if the MP3 files you want to stream with the following:
find [MP3 directory] -name *.mp3 -print > playlist
At it's most basic level, to start the shout service, issue the following:
[dj@megajukebox bin]# ./shout megajukebox -P hackme -p playlist
The -P option specifies the password needed to add a mount-point to Icecast, this is the aptly set as hackme..... I strongly suggest you change it otherwise someone may :) The -p option specifies the location of the playlist file.
Below is a list of all of the command line options:
[dj@megajukebox bin]# ./shout Usage: shout <host> [options] [[-b <bitrate] file.mp3]... Options: -B <directory> - Use directory for all shout's files. -C <file> - Use file as configuration file -D <dj_file> - Run this before every song (system()) -P <password> - Use specified password -S - Display all settings and exit -V - Use verbose output -X <desc> - Use specified description. -a - Turn on automatic bitrate (transfer) correction -b <bitrate> - Start using specified bitrate -d - Activate the dj. -e <port> - Connect to port on server. -f - Skip files that don't match the specified bitrate -g <genre> - Use specified genre -h - Show this text -i - Use old icy headers -k - Don't truncate the internal playlist (continue) -l - Go on forever (loop) -m <mount> - Use specified mount point -n <name> - Use specified name -o - Turn of the bitrate autodetection. -p <playlist> - Use specified file as a playlist -r - Shuffle playlist (random play) -s - (Secret) Don't send meta data to the directory server -u <url> - Use specified url -v - Show version -x - Don't update the cue file (saves cpu) -z - Go into the background (Daemon mode) -t - Enable title streaming
After untaring the bundle cd to the directory, then read the README :)
Fluid has three basic modes of operation, transmit, relay and forward. I'll only focus on transmit.
The config files associated for transmit are located in config/MP3TX.cfg. To test the server run with the following, at this point the default config settings should be ok:
java Fluid TX
Naturally enough you'll need Java of some form installed first. You can use either the Blackdown port of JDK available from http://www.blackdown.org or if you are using Redhat, Kaffe.
Fluid comes with a few sample MP3 files, so if everything is working you should see something similar to this (I've started the server using Kaffe in this example, you may have to start it using java):
[dj@megajukebox Fluid-Beta2J]$ kaffe Fluid tx ------- Fluid Streaming Server Beta 2 ------- This program is ShareWare(tm) and it will not be crippled in any way because of it. However if you do like the program and will use it commercial purposes, we ask of you to contact us at the address below for pricing info: Eldean AB E-mail: Sjoangsvagen 7 fluid@subside.com S-192 72 Sollentuna SWEDEN Fluid is Copyright Subside (C) 1998 written by Lars Samuelsson http://www.subside.com --------------------------------------------- * Transmission mode * Reading config from: config/MP3TX.cfg Reading playlist: playlist.m3u Server started on port: 2711 Accepting administrator login on port: 2710 P| Dr. Nick - Hello Everybody
If you get this far, it looks like things are working, but I'm sure you'll want to stream more than the demo files!
You'll need to compile a playlist of the MP3's you want to stream. This will be a static list users will not be able to alter this list or make requests. This playlist is named playlist.m3u and is located by default in the root directory.
To compile a playlist of all MP3's in a particular directory (or disk) use the following command:
find [MP3 directory] -name *.mp3 -print > playlist.m3u
By default the server uses port 2711, which is where your listeners will connect to, if you need to change this this can be done in the config file.
The server can be remotely administered by telneting to it's admin port, by default port 2710 like so:
[dj@megajukebox Fluid-Beta2J]$ telnet localhost 2710 Trying 127.0.0.1..megajukebox Connected to localhost.localdomain. Escape character is '^]'. jaguar You are connected to the -Fluid- Streaming Server Type "help" for a command reference help The following commands are available: help conn curr exit curr Information about the currently broadcasted song: Title: Beer Talk Artist: Homer Simpson Album: The Simpsons Year: 1996 Comment: Borrowed this as an example Genre: Comedy
The reference to "jaguar" is the admin password, this is the default. There is no prompt for the password so please don't sit there waiting for one! I suggest that you change the password from the default otherwise you will invite a hack! This can be changed in the config file, which looks like this:
[dj@megajukebox config]$ cat MP3TX.cfg 2711 2710 5 4096 32 1000 jaguar playlist.m3u current.txt # --- The lines are --- # 1. PORT number (the server will use) # 2. PORT number (for maintaining the server remotely) # 3. Maximum number of connections (the server will accept) # 4 Packetsize when reading/sending (in bytes) # 5. Bitrate of the mp3s in kbit/s (all mp3s must have same bitrate) # 6. Delay between songs (in milliseconds) # 7. Password for remote administration # 8. Playlist name (list in .m3u format) # 9. Name of the file to write song info to (from ID3-tag)
The reference to the playlist being in m3u format means that it is in the same format as produced by the find command mentioned earlier.
Streaming audio can consume vast quantities of bandwidth if the MP3 servers' bit-rate is set too high.
Consider this scenario. A T1 link has a capacity of approx. 1.55 Mb/Sec. If you stream your MP3's at 128K/Bps stereo, each connecting player will use 256K/Bps, so only 6 users could connect to your MP3 server at any time without problems. And at 256K/Bps, you will not get too many modem users connecting!
So you must make a decision at what to set your stream rates not only on what your server's internet connection is rated at, but what your users will be connecting at. 24K/Bps Stereo will give a reasonable quality signal that 56K modem users will be able to connect to, and for the same T1 line would allow approx. 32 simultaneous connections.
If your server is running on an Intranet, bandwidth issues will still have to be considered especially if your network is running 10M/Sec.
But please let either your ISP or sys admin know you are going to stream otherwise you may be in for a shock. Some ISP's will charge you for bandwidth over a certain limit and sys admins like to know why their network is now running slow :)
I think it's reasonable to assume that record companies will not like you streaming material without their permission or payment of some kind! So what can you stream?
This is an area where you will need to be aware of the legal ramifications, because it will be you who will be liable.
Below are two links, one for the Electronic Frontier Foundation who are advocates of freeing restrictions surrounding the technology. The other link is to the Recording Industry Association of America, which seeks to protect the rights of artists from piracy.
I strongly suggest visiting both of the sites, and any others relevant to where you are physically based.
http://www.riaa.com/weblic/weblic.htm