Category: shoutcast

stream audio continously

Posted by – March 23, 2009

I recently installed shoutcast on one of my VPS accounts and wanted to stream music even when I don’t have the DNAS program (or any other dj program).

What I did was download a couple podcast shows and wanted to play them. There is a program the shout cast guys developed called sc_trans. It transcodes files to the shoutcast server.

The download link on the shoutcast site doesn’t link to the right place so its a bit trivial. I’ve included the link at the end of this post.

You will need to generate a playlist of the files you want to play and can do that with:

# find /Mp3 -type f -name "*.mp3" > /opt/shoutcast/playlists/playlist.lst

Which will make a playlist from all the mp3s in the /Mp3 dir and save it in /opt/shoutcast/playlists/

There are quite a few options in the sc_trans.conf file you will want to look at.

sc_trans will only play the files with the same sample rate. You’ll have to resample all your mp3s to the same rate :(

For example, in the sc_trans.conf if you specify

SampleRate=32000

It will only stream files with 32Khz sample rate. You can use the lame program to re-encode your files by doing the following (this re-encodes into 44Khz):

lame --resample 44.1 InputFile.mp3 OutPutfile.mp3

If you want to re-sample an entire directory of mp3s, you can use a shell script:

#!/bin/sh

for i in *.mp3; do
lame --resample 44.1 ${i}
done

Save that as lame.sh, chmod + x lame.sh and then ./lame.sh

Here is a overview of some of the settings of sc_trans and shoutcast itself. It is an excellent guide. Streaming Radio with Shoutcast

Download sc_trans from Shoutcast.com here