1. Introduction
Before writing this article, I also found a lot of materials, but many others were too old and did not give them a valid
There are two options: Icecast and ShoutCast. Since Linux and open source are used
I did not hesitate to select the open-source Icecast as the playback server.
In the LAN, you can also play videos to many people on the Internet and use ICES as the media source. Entire Architecture
Icecast is used as the playback server, and ICES is used as the media collection source.
It should be noted that the current Icecast version is icecast-2.2.0 and she supports MP3 and Ogg. ICES has two primary nodes
Version 2.0.x and 0.4.x are recommended. The latest 2.0.x only supports Ogg and does not support MP3, while 0.4.x
Only support MP3. this makes me configure for a long time, but also only support Ogg, read so many MP3.
I unloaded 2.0.x and loaded 0.4.x on the home page. Of course, if you only use Ogg, it is simpler,
I don't need to be here.
Both software can be downloaded on the http://www.icecast.org. Friends who use Gentoo can only
The advanced versions of Icecast and ICES are obtained in portage, and the earlier versions to be introduced have to be downloaded and compiled manually.
This article is based on darfsnuzal's speech at forums.gentoo.org. I'm using a Icecast-2.2.0, and ICES-0.4.
2. Install
This is the simplest, for Icecast.
Emerge Icecast-PV
For manually downloaded ices
./Configure; Make; make install
3. Configuration
A. Previous Work
Because Icecast is a server playing to the network, to avoid unnecessary vulnerabilities, You do not have permission to use it.
As the execution user.
# Groupadd Icecast
# Useradd Icecast-m-g Icecast-G users, wheel, audio-S/bin/bash
# Passwd Icecast
# Mkdir/home/Icecast
# Chown Icecast: Icecast/home/Icecast
# Cd/home/Icecast
# Su-Icecast
$ Mkdir log
$ CP/etc/icecast2/Icecast. xml ./
I imagine that all relevant content should be installed under the/home/Icecast directory, configuration file, and diary.
All files are here. Write a new configuration file to avoid conflict with the system file.
B. Configure Icecast,
Let's take a look at the changes in the Icecast file. This is an XML file. It is important for security.
<Source-Password> $ passwd </source-Password>
# This indicates where the server obtains the media source,
# It is from ICES. It must be the same as the password in the ICES setting file.
<Relay-Password> $ passwd </relay-Password>
# This means that when the server is played back to the next-level server as a server
# Password used by other servers to access her.
<Admin-user> admin </admin-user>
# This is the user name used for webpage logon. It is the administrator identity. Do not use it unless necessary. The default user is admin.
<Admin-Password> hackme </admin-Password>
# The default password above is hackme.
<Hostname> localhost # Host name, localhost is correct, unless ....
<Logdir>/home/Icecast/log </logdir>
# Diary file. I threw her here. You can do it yourself.
<! -- # Delete
<Changeowner>
<User> Icecast </user> # Change nobody to Icecast
<Group> Icecast </group> # Change nogroup to Icecast.
</Changeowner>
--> # Delete
<Listen-socket>
<Port> 8000 </port>
<Bind-address> 0.0.0.0 </bind-address>
# Setting the listen IP address to 0.0.0.0 is open to all IP addresses. Port is 8000
</Listen-socket>
# There is no need to make changes for others. That's it. The Icecast configuration is complete.
By the way, verify that the file configuration is correct.
$ Exit
# Icecast-B-c/home/Icecast. xml
If such a row is found in/home/Icecast/log/error. Log, that's all.
[01:06:32] info main/main Icecast Server started
C. Configure ices,
In fact, the configuration files of the two generations of ICES are almost the same. It is no difficulty to see if they are all configured.
# Su-Icecast
$ Cd
$ CP/usr/local/etc/ices2/ices-conf.dist./ices-playlist.xml
Now we can change it.
<File> list.txt </File>
# Specify a playlist file, which is generally m3u or something. You can store it wherever you like.
<Randomize> 1 </randomize>
# Do you want to play the video randomly? 1 is 0 or not.
<Background> 1 </background>
# Run ICES as the background instead of the foreground.
<Hostname> localhost <Port> 8000 </port>
<Password> Iloveyou </password>
# This is the interaction with Icecast, which can be consistent with Icecast.
<Mountpoint>/PPMM </mountpoint>
# This is the suffix. In this case, the actual playback address is http: // localhost: 8000/PPMM.
<Public> 1 </Public>
# Whether to enable external access.
<Name> baozhu </Name>
# I love baozhu, hey.
Yeah, it's done, and finally it's done. Verify it.
# ICES-C ices-playlist.xml
4. Start
I was planning to use a system service, but I didn't write it well, and the result was depressing,
I have made a mess of things, and they are all set up by myself. Don't laugh at me, just look at what you mean.
Yes.
$ CAT/etc/init. d/Icecast
#! /Sbin/runscript
Depend (){
Need net
Use DNS
}
Start (){
Ebegin "Starting Icecast 2"
Start-stop-daemon -- background -- start -- pidfile/var/run/Icecast. PID -- make-pidfile -- exec/usr/bin/Icecast ---B-c/home/Icecast. XML>/dev/null 2> & 1
Eend $?
}
Stop (){
Ebegin "Stopping Icecast 2"
Killall Icecast
Rm-RF/var/lib/init. d/started/Icecast
# Start-stop-daemon -- stop -- retry 5 -- quiet -- pidfile/var/run/Icecast. PID/usr/bin/Icecast
Eend $?
}
This program is mainly because the service cannot be properly disabled every time/etc/init. d/Icecast stop.
I 've been busy for a long time, so I had to use force means, hey.
Two executable files start and stop are created under/home/Icecast /.
$ Cat start
/Etc/init. d/Icecast start
ICES-C ices-playlist.xml
The first line can also be done without system services. Use the command line directly:
Icecast-B-c/home/Icecast. xml
Note that ICES can use a series of parameter lists, but it is best to use-C to specify the configuration file.
The new ices version does not use any parameters. Everything is concentrated in the configuration file.
$ Cat stop
Killall ices
/Etc/init. d/Icecast stop
It is a mandatory method, and there is no way to do it. I cannot find a good solution. Fortunately, I can still work normally.
So the next step is very simple.
Start:./start
Turn off:./stop
Open with player
Http: // localhost: 8000/PPMM
You can enjoy music.
5. Description
In this process, you can use a browser to log on to http: // localhost: 8000/admin/stats. XSL: Check the current status. The key is to check the listmount. It indicates that ICES has been directed
Icecast provides media sources, both of which are working properly. However, the Icecast Web Settings seem to be faulty. log on to
This machine has no action, and the number of connections will reach 100 in a moment, which makes me very uncomfortable.
Also, the list.txt file is a common m3u file, which is composed of MP3 files on your machine.
Run the following command to query all MP3 files on the hard disk and save them as M3U files. For example:
$ Find/-name "*. MP3">/home/Icecast/playlist. m3u
Of course, you can replace/with the folder where your media is located.
6. Others
We have no technical skills. If you have any mistakes, forgive me.
Think about the other things that can be improved for my configuration, and make the startup easier, such
The Startup Script of Icecast is better written, so it is much easier to run files around, but I am also lazy.
In summary, if you only play the Ogg file, you can directly play the latest version of Icecast and the latest version of ices.
All of them are good. The configuration is not much different. In addition to this method, you can also use muse to play only MP3 files.
This program provides media sources instead of ices. The configuration is also relatively simple, I will not introduce it, the reason why not use her is mainly
Two points. One, she cannot play in disorder. 2. She cannot display id3tag. In addition, log is not supported and the background is not supported.
Start. This is what I mentioned in my introduction. I have never tried it, and I have never personally estimated it and believe it.
7. Write it at the end
Why do I remember to configure this item, mainly because the rare minibus was broadcast again in BT?
However, it was my most familiar TV theme song show. I haven't been listening to the broadcast for a long time. I'm so happy. Think about it
Once you enable the broadcast on your own or use Winamp + ShoutCast configuration in windows, If You Want To enable it later, of course, this
Is there a high possibility of opening? There are so many TV songs piled up on the machine. I don't want to listen to them, but I don't want to open them.
So, after listening, I found the information, installed the software, and studied it openly. Now, we have finally achieved success.
Now, everyone in the distance can hear the trembling voice of my machine. I want to classify these hundreds of songs,
It's too cumbersome. Never do it.