|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|Originally Published: Saturday, 18 November 2000||Author: Phil Kerr|
|Published to: enhance_articles_multimedia/Audio Articles||Page: 1/1 - [Std View]|
Introduction to Streaming MP3
We've got a great one for you today. Phil Kerr, author of the famed Linux MP3-HOWTO, has written a fantastic introduction to streaming mp3 for our readers. Learn how to stream mp3 from one of the best. Rock on, Phil!
If you download an MP3 file to your machine and then listen to it, you are essentially copying the MP3 file from the Internet server to your local machine. There now are various waysyou can download MP3's such as:
Streaming is more analogous to listening to a radio station. You "tune in" and listen. There are a handful of servers you can use under Linux.I'llexplain how to set-up an IceCast server together with two different ways of connecting a "source" LiveIce & XMMS-LiveIce.
First you must obtain a copy of IceCast and install it. There are links at the end of this article, including one to IceCast. You should have a choice of what package format to download: Binary, RPM or source code. I'll be downloading the source code.
After downloading you'll need to install it.
tar zxvf icecast-1_3_5_tar.tar.gz
[Lots of lines of the contents, no errors]
[Lots of lines of checking, no errors?]
[Lots of lines of make, still no errors?]
make install [as root]
[Last few lines of make, no errors? Good!]bash-2.04# ls -l /usr/local/icecast/
drwxr-xr-x 2 root root 4096 Nov 16 20:09 bin
drwxr-xr-x 2 root root 4096 Nov 16 20:09 conf
drwxr-xr-x 2 root root 4096 Nov 16 20:09 doc
drwxr-xr-x 2 root root 4096 Nov 16 20:09 logs
drwxr-xr-x 2 root root 4096 Nov 16 20:09 static
drwxr-xr-x 2 root root 4096 Nov 16 20:09 templates
Change directory into conf/. Here we'll find a set of distribution config files. We want icecast.conf.dist. Copy this file to a file called icecast.conf in the same directory and edit the following lines:
# hostnameIf this is not set correctly IceCast will not work properly.
Start it up!
So, configuration now done, it's time to start the server. Change directory to bin/ and type the following:
#./icecast -c ../conf/icecast.conf -b
The options specify the location of the config file, and the -b option starts the server in the background.
bash-2.04# ./icecast -c ../conf/icecast.conf -b
Icecast Version 1.3.5 Initializing...
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.
Starting thread engine...
Just to make sure, check to see if the process is running with a ps command:
bash-2.04# ps -ef|grep icecast root 7776 1 0 20:48 pts/0 00:00:00 ./icecast -c ../conf/icecast.conf -b root 7777 7776 0 20:48 pts/0 00:00:00 ./icecast -c ../conf/icecast.conf -b root 7778 7777 0 20:48 pts/0 00:00:00 ./icecast -c ../conf/icecast.conf -b root 7779 7777 0 20:48 pts/0 00:00:00 ./icecast -c ../conf/icecast.conf -b root 7780 7777 0 20:48 pts/0 00:00:00 ./icecast -c ../conf/icecast.conf -bYou can check the status of the server by examining the server logfiles in the log/ directory. OK, sothe server started.You can't wait to start streaming, can you?
We now need to connect a source to the server. That source will provide the server with a list of MP3's or a connection to the soundcard.
LiveIce provides a source from both MP3 files and from the line-in/microphone socket on your soundcard.
You will need a few other files to get things running:
tar zxvf liveice.tar.gzYippee, installed! Now we need to configure it. In the Liveice directory there is a TK script which you use to create liveice.cfg named liveiceconfigure.tk. This script launched a GUI based configurator. You'll have to set the values that match your IceCast setup. Here are the others:
./install-sh liveice /usr/local/bin [as root]
16Bit 22050Hz Stereo
opening connection to megajukebox 8000
Attempting to Contact Server
connection successful: forking process
Setting up Interface
Soundcard Reopened For Encoding
Input Format: 16Bit 22050Hz Stereo
Output Format: 32000 Bps Mpeg Audio
IceCast Server: megajuxebox:8000
Press '+' to Finish
Adding New Channel 1
Adding New Channel 2
Channel 1 selecting
Channel 2 selecting
searching for Id3v2
searching for Id3v1
making up the info
Using log track.log
You should see numbers flashing after the startup messages. These indicate the volume of the input source. If you selected to use the soundcard input and the signal is too high you will see *clip*.
Below is a list of keyboard commands:
|Action||Channel 1 Key||Channel 2 Key|
|Select prev track on channel||q||z|
|Increase volume on channel||3||d|
|Decrease volume on channel||e||c|
|Increase speed on channel||4||f|
|Decrease speed on channel||r||v|
|Sticky mode On/Random/Off||5||g|
XMMS-LiveIce is a streaming module for XMMS (versions greater that 1.0.0). It allows you to stream MP3's using the XMMS player. If you download the source code, you will have to configure and make as the others.
Once installed you will need to start XMMS and enable the plugin. From the menu's go to Options->Preferences and select Effects. The Effect plugins pulldown should now show LiveIce 1.0.0 (or a similar version number). Select this and click on the Configure button. The parameters are very similar to those of LiveIce and should be set to those of your system.
Once enabled, start playing MP3's as per normal and in the logs of IceCast you should see XMMS as a source.
So, now you should be able to stream MP3's from an IceCast server using LiveIce or XMMS!