Kernel_Killer
June 21st, 2003, 04:05
Not sure if anyone will ever use this, but I know it was a PITA for me since the shoutcast forum pointed to URLs that didn't show anything, and the docs were Win oriented. Thanx Strog for the help with streaming!!

Start by installing the ShoutCast server port.

cd /usr/ports/audio/shoutcast && make install clean


Configuration:

Ok On to the config file. Jump into /usr/local/etc/shoutcast. After that use your favorite editor to edit the sc_serv.conf file. Let's look at what you will change. Most is very self-explainitory, but what the hey.


Password=changeme

Change this password to what you want for the HTTP admin mode.


PortBase=8000

This is the port the server will run off of. Change this if you have a server running off this port, or just want to be different. Remember! Any port below 1024 will cause the server to have to be run by root/su/sudo.


SrcIP=ANY

Just for security reasons, you might want to change the 'ANY' to '127.0.0.1' to keep others from broadcasting off your server. If you are not worried about it, leave it alone.


DestIP=ANY

Change this to IP of your system. For people not connecting through a router, switch, or hub this will most likely be your Internet IP.

This is probably a good thing to change if you have a network. Really it won't matter too much, but keeps Request packets from bouncing around your network or catching other listeners going to a different host.


AdminPassword=adminpass

In a nutshell, this password keeps those people who got into your HTTP admin from Kicking, Banning, and changing other critical options from the admin page without having to put in another password.


; ContentDir=./content

This is the directory in which you want to have your MP3s set. ./content sets it to be the Present Working Directory where 'sc_serv' was executed. This is really only important for On-Demand broadcasting.


TitleFormat=Screaming Electron Radio: %s

Name your station here.


I never found a way to get a playlist working, nor did I really want to, but I'll show you the basics to getting On-Demand Broadcasting working.

Setting up the webpage:

Please bare with me on this one since I'm going to show you how to set this up using your own web server. First off, we need to put a HTML page in one, or your only web site directory.

Default Directories:


FreeBSD:

/usr/local/www/apache22/

The HTML file should look something like this:


<html>
<head>
<title>index.html</title>;
</head>;
<;body>
My Shoutcast Page<br>
<br>
<a href="http://www.yourdomain.com:8000/music.pls">Music</a>
<br>
<a href="http://www.yourdomain.com:8000/music2.pls">Music2</a>
<br>
</body>
</html>


The two links in the page, music.pls and music2.pls, will point the listener to that song as long as it's the directory you have the page in. When you click the music.pls link, it will search for a file called music.mp3 in that directory.
I'm sure there are other ways to do this, like making it point to another directory in your web path, but like I said, I'm just showing the basics.


Streaming Broadcasts:

Ok. Time to get down and dirty. Let's get some files streaming.

For this, I prefer Holyshout. You can find it in the ports at /usr/ports/audio/holyshout/.

Before compiling, you might want to edit the holyshout.h file found in the new holyshout directory, or in FreeBSD it will be in /usr/ports/audio/holyshout/work/
holyshout/. The only things you will want to change are your, MAX Buffer, and Minimum Buffer to keep a smooth stream.

Piece of cake. Bad thing is, if you want to change your buffer again, you will need to recompile. In FreeBSD you will have to deinstall, and reinstall.


Running HolyShout:

This is a pretty simple execution. The main options you need to know are:

-P [Port] : Shoutcast admin port
-p [password] : Shoutcast admin password
-z : Shuffle Play
-b : Outgoing bitrate
-l [dir] : Directory to playlist
-n [name] : Station Name
-i [host] : Host name of the server for headers

Ok. To sum it up, you will run it like so:

holyshout -P 8001 -p password -z -b auto -l /mp3s/music.playlist -n MyStation -i host.domainname

Simple as that. Beware of the '-b auto' function. If you are running on a limited upload, you will probably want to set this to something like '32', '64', '128', '192' (or higher) instead of 'auto'. The only trouble with setting a distinct bitrate, is that both ShoutCast and HolyShout are very sensitive to "dumbbing-down" mp3s that don't match that bitrate. So if it carshes and you don't know why, check your bitrates of your mp3s first.


Re-encoding mp3s, and converting WAVs to mp3s:

You are probably going to want to use LAME for this task, and other things also. In the time of this revision, it is marked as a dependancy of HolyShout.


Reecoding mp3s with LAME:

lame -b bitrate -h input.mp3 output.mp3

*WARNING* If you are dropping the mp3 bitrate, you might want to make the output name different from the input file since you can't raise the bitrate back up to it's natural bitrate *WARNING*


Encoding WAV files to MP3s:

same as above except use a WAV file as the input:

lame -b bitrate -h input.wav output.mp3


Reencoding Oggs to MP3:


To do this you might want XMMS installed. There are other ways, but this is easier. Open up XMMS, and put the oggs into the playlist. Then right-click your main XMMS panel, go to Options &gt; Preferences. In the Audio I/O Plugins tab, Click the drop-down menu in the Output Plugin area, and choose Disk Writer Plugin. Click 'configure' below the drop-down menu, and choose the directory you want the WAV files to be saved. After you have done this, click
"Apply", and "OK". Go to your main XMMS panel and press Play. You won't hear anything, and the timebar will start scrolling fast. After it's done going through all the songs, go into the directory you set to save the files, and look at your new WAV files. Once this is done, start re-encoding them to MP3s with the last LAME command shown above.


Making Playlists:

Instead of using XMMS as I recommended before, there is another way that is just as easy, if not easier. This is also CLI-friendly, and doesn't require X in any way shape or form.

[b]find /usr/Shared/Music/Converted -type f -name "*.mp3" | grep oundtrack > Soundtracks.lst

Of course, you can remove the 'grep' command, and insert all your music, or change the condition to get other folders. If you want to append to the file, remember to add another '>' to the command.

find /usr/Shared/Music/Converted -type f -name "*.mp3" | grep classical >> Soundtracks.lst


Network Setup:

After looking through the forums, I can't count the times I've noticed errors from forwarding and firewalls.

First, set your firewall to accept the incoming port from shoutcast (default 8000).

Next let's look at the router config (If you use a router). Most economy routers will have an "advanced settings" tab, or something to that nature in the Admin Web Interface. In the advanced setting, you should find a "forwarding" section. Set the source port and source IP to be "*" or blank (whichever your router uses for "ALL"). Next set the Destination Port to 8000, and the Destination IP to your server internal IP address (i.e. 192.168.1.124). If you still have trouble with people connecting, make sure you don't have that port filtered to be blocked by the router. This will be in a "packet filter" section. Some routers will not have this. Also, when working with D-Link Routers, set a Virtual Server to the destination port and destination address.


Well, hope you find this HOW-TO helpful. Enjoy!

Kernel_Killer
March 29th, 2008, 10:40
Revised