Stable, use linux to build your own mp3 broadcast station

Source: Internet
Author: User
Tags builtin touch command icecast icecast server perl script reverse dns
Article title: Stable. use linux to build your own mp3 broadcast station. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Icecast is an Internet broadcast system based on Mpeg III technology. Compared with commercial software such as shoutcast, icecast has the following features:
  
Icecast is a pure OpenSource software;
You do not need to run your own directory server;
Occupy less system resources;
We can run our own streaming server -- icecast on the server and use ices to provide the container. the client can use the most commonly used winamp.
  
   Test environment:
Server Platform: RedHat 7.0
  
Streaming Server: icecast
  
Usage: ices
  
Mp3 encoding tool: lame
  
   Steps:
1. obtain related software
  
Stream server icecast: http://www.icecast.org/releases/icecast-1.3.10-1.i386.rpm
  
Utility tool ices: http://www.icecast.org/releases/ices-0.0.1.beta5.tar.gz
  
Coding tool lame: http://home.elka.pw.edu.pl /~ Dmierzej/linux/lame/lame-3.87beta-1.i386.rpm
  
Lame: http://home.elka.pw.edu.pl /~ Dmierzej/linux/lame/lame-devel-3.87beta-1.i386.rpm
  
   Note:
A. generally, liveice, shout, and other software can be used to provide a stream (that is, serving as a stream) for the stream server. However, I found that ices is stable during use, although it is still a beta version.
  
B. generally, each mp3 file cannot have the same attributes. at this time, some strange phenomena may occur during the broadcast process, such as intermittent and noisy sounds, therefore, we must use the mp3 encoding tool lame to encode it again to generate mp3 files with consistent attributes.
  
2. install icecase
  
Run the following command to install icecast:
  
Rpm? Ivh icecast-1.3.10-1.i386.rpm
  
3. install ices
  
Run the following command to install ices:
  
# Tar xvzf ices-0.0.1.beta5.tar.gz
  
The ices-0.0.1.beta5 directory is generated under the current directory, and the cd command is used to enter the Directory
  
# Cd ices-0.0.1.beta5
  
Then execute:
  
#./Configure
# Make
# Make install
  
The compiled files are installed in the/usr/local/icecast directory by default.
  
4. install lame
  
Run the following command to install the lame mp3 encoding tool. This tool is used to re-encode mp3 files to generate mp3 files with consistent attributes.
  
Rpm? Ivh lame-3.87beta-1.i386.rpm
Rpm? Ivh lame-devel-3.87beta-1.i386.rpm
  
5. configure icecast
  
The main configuration file of icecast is/etc/icecast. conf, which has many configuration options, but most of them only need to adopt the default configuration. some options are described as follows:
  
Port: defines the Port bound to the icecast service. only one Port can be set. Port 8000 is usually used.
  
Encoder_password: password used to connect to the kernel. ices must provide this password when providing a stream for icecast. for security reasons, you can set a complicated password.
  
Admin_password: you can use telnet to log on to icecast for remote management. this password is the one you must enter when logging on to icecast.
  
Oper_password: password used by telnet to log on to icecast to execute the restricted command.
  
Max_clients: maximum number of customers allowed to connect to the streaming server within the same time.
  
Max_sources: maximum number of workers that can be broadcast at the same time. the stream source and stream server can be located on different machines and multiple workers can be transmitted to the same stream server for broadcast.
  
Max_admins: number of connections that can be remotely managed by logging on to icecast at the same time.
  
Logfile: set the location of the log file.
  
Hostname: set the IP address bound to icecast. it is bound to all IP addresses by default.
  
Server_name: specify the host name or IP address of the icecast server.
  
Client_timeout: Set the timeout time when the server disconnects the connected customer when no timeout occurs.
  
Stats_log: Set the log file that records icecast statistics.
  
Stats_time: Set the update period of the stats_log file.
  
Max_clients_per_source: sets the maximum number of customers that can be connected to the same region at the same time.
  
Reverse_lookups: Sets whether to reverse DNS resolution can be performed on connections. if the value is 0, reverse DNS resolution is disabled. if the value is 1, reverse dns resolution is enabled.
  
Location: set the geographic Location of the icecast server. setting or not is not important.
  
Rp_email: Set the email address of the icecast server administrator.
  
Throttle: the bandwidth threshold that can be used by the icecast server. If this threshold is reached, new customer connections will be rejected, in megabytes/s.
  
Logfiledebuglevel: defines the log details.
  
Server_url: defines the RUL of The icecast server
  
The following are my configuration files for your reference only:
  
# Icecast. conf
Location Yuxi Yunnan China
Rp_email bye2000@yxtc.edu.cn
Server_url http://www.yxtc.edu.cn/
Max_clients 900
Max_clients_per_source 900
Max_sources 10
Max_admins 5
Throttle 10.0
Mount_fallback 1
Encoder_password secret
Admin_password secret
Oper_password secret
Port 8000
Force_servername 0
Logfile icecast. log
Accessfile access. log
Usagefile usage. log
Logfiledebuglevel 0
Consoledebuglevel 0
Reverse_lookups 0
Lele_mode 0
Client_timeout 30
Kick_clients 0
Staticdir/usr/share/icecast/static
Templatedir/usr/share/icecast/templates
Logdir/var/log/icecast
Stats_log stats. log
Statshtml_log stats.html
Stats_time 60
Kick_relays 10
Transparent_proxy 0
Acl_policy 1
  
6. start the icecast service
  
Run the following script to start the icecast service:
  
#/Etc/rc. d/init. d/icecast start
  
7. Recode all mp3 files
  
Use lame to re-encode mp3 files to generate mp3 files with consistent attributes.
  
The following parameters of the Lame command are used:
  
-- Mp3input: the input file is an mp3 file.
  
-M s: specifies that all frames are stereo.
  
-B 56: specifies the baud rate of the newly generated mp3 file, which is 56 kbps in kbps.
  
-- Resample 24: specifies the sampling frequency of the newly generated mp3 file. The value is 24 KHZ, and the unit is KHZ.
  
The following is an example of lame usage:
  
Lame -- mp3input-m s-B 56 -- resample 24 old.mp3 newexample
  
8. generate a playlist
  
You can use the following file to generate a playlist:
  
# Find/-name '*. mp3'> play_list_file
  
Change play_list_file to the name of your playlist file.
  
The following is an example of a playlist file:
  
# Play_list example
/Data/mp3/PowerStation/byemylove/1.mp3
/Data/mp3/PowerStation/byemylove/10.mp3
/Data/mp3/PowerStation/byemylove/11.mp3
/Data/mp3/PowerStation/byemylove/2.mp3
/Data/mp3/PowerStation/byemylove/3.mp3
/Data/mp3/PowerStation/byemylove/4.mp3
/Data/mp3/PowerStation/byemylove/5.mp3
/Data/mp3/PowerStation/byemylove/6.mp3
  
As you can see, you only need to include the complete path and file name of the mp3 file.
  
9. publish stream
  
Ices can use xml-based configuration files or command with options. here we use the latter. common command options include:
  
-B: specify how ices will run in the future.
  
-B: specifies the baud rate.
  
-D: Stream description
  
-N: Set the name of the broadcast station.
  
-G: the type of broadcast music.
  
-H: streaming server IP address
  
-P: Listener port of the stream server
  
-P: The password used to connect to the streaming server.
  
-R: set random playback of songs
  
-S: specifies the type of the playlist, usually using builtin
  
-U: specifies the URL of the streaming server.
  
-F: specifies the playlist file.
  
My example:
  
/Usr/local/icecast/bin/ices? B? B 56? D MUSIC
? N "TOM Radio "? G music? H localhost
? P 8000? P secrue? R? S builtin? U
Http://www.yxtc.edu.cn: F/etc/icecast/list
  
10. receive broadcast
  
Users can receive broadcasts in a way similar to the following:
  
Create a file with the extension m3u. for example, if my file is tom. m3u, the file contains the following content:
  
Http://www.yxtc.edu.cn: 8000/
  
Then, create a hyperlink to the file on the homepage. once you click the connection, mp3 players such as winamp and realplay will be started to receive broadcasts.
  
We recommend that you use winamp to receive broadcasts.
  
Well, it's done. sit down and make a cup of coffee and enjoy your mp3 broadcast.
  
11. Additional instructions:
  
I wrote a perl script that automatically searches all mp3 files in the system, then, mp3 files with non-56 K baud rate and 24 kHz sampling frequency are converted into mp3 files with a 56 k baud rate and a 24 kHz sampling frequency using lame. after the conversion, a playback list is automatically generated.
  
Usage:
  
./List_gen list_file
  
You must use the touch command to create the list file.
  
This script requires your system to install the lame tool.
  
The script source code is as follows. you can also download it from here:
  
#! /Usr/bin/perl
  
'Rm-f/tmp/temptid ';
If (! $ ARGV [0]) {
Print "Usage:./list_gen list_file_name ";
Print "You mu
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.