Saturday, May 22, 2010

Internet Disconnection Letter

Create a Web radio station Icecast 2 and Ices 2 in Ubuntu

Well, this little tutorial will show how to create a Web radio station in Ubuntu icecast2 as a server using emission and ices2 as a source for the server. Although this can be done in any linux distribution I recommend a ubuntu. I did it with kubuntu 9.10 (karmic). Install the packages

Well, the first is to install the packages that will be needed for the station. If you prefer to use a graphical package manager like synaptic or adept no problem, leave it here anyway console code to do so. Packages that need are icecast2 and ices2

$ sudo apt-get install icecast2 ices2

Set Prepare

Icecast station

First prepare icecast. Icecast uses a xml configuration where all the parameters of the station as well as some files to the web interface, some default files are installed with the packages, you have to make a copy of them in the user directory that should not be run as root icecast .

First create a directory structure to house files and registry settings icecast, being in our home run: mkdir

$
$ cd icecast icecast
$ mkdir conf $
mkdir logs

we copy the default configuration file to the folder icecast we created. in kubuntu that file is / etc/icecast2/icecast.xml If the file is not there then you can use the find command to find this:

$ find /-name "icecast.xml"

Note: in some distributions of linux system folders are protected, users can not access them (even to read) if this is your case use sudo when the system tells you that you can not read files cd

$
conf cp $ / etc/icecast2/icecast.xml icecast.xml
$ sudo chown user : group
Since

icecast.xml that the file belongs to root chown we used to do that we now belong to us. Eye here! where I placed user and group must put your username and group respectively, usually ubuntu is the same group name to the username in my case, for example, both my username and my group are called sergio so the command would be: sudo chown sergio: sergio icecast.xml

We do not modify the configuration file before copying the folders that the icecast used for web interface. These folders are usually located in / usr/share/icecast2 but if not there remember that you can use the find command to locate them.

$ cd .. $
cp-r-L / $
web usr/share/icecast2/web cp-r-L / usr/share/icecast2/admin admin
$ sudo chown-R user: group admin
$ sudo chown-R user: group web

Remember to replace user and group for your username and group respectively.

Ok, now if we set up icecast to modify this configuration file that we copied:

$ cd conf $ kate icecast.xml
kate

If you can use gedit or other editor but try if possible to use an editor that will highlight the code to make you easier to locate the lines.

Well, let's go edit the lines in the order they appear in the file, so stay tuned.

\u0026lt;clients> 10 \u0026lt;/ clients>

This line sets the maximum number of clients (players) that can connect to your station. Usually this is adjusted according to the amount of bandwidth that is available for broadcast. A reasonable value is 50. If you wait more than 50 clients maybe this tutorial is not for you.

\u0026lt;source-password> hackme \u0026lt;/ source-password>

In this line by placing the password to the sources (in our case the ices2) will use to login to the server and send the music. It is recommended to change the default password to prevent someone else can give to your server.

\u0026lt;relay-password> hackme \u0026lt;/ relay-password>

In our case we will not use relays but you must change this password for security.

\u0026lt;admin-user> admin \u0026lt;/ admin-user>
\u0026lt;admin-password> hackme \u0026lt;/ admin-password>

This is the user name and password logearte used in the web administration module Icecast. I recommend you change both the username and password for security.

\u0026lt;hostname> localhost \u0026lt;/ hostname>

If your station is mounted on a server that you access with a domain that you purchased here put the name of the domain, miradio.org eg. If you're building a test server localhost you enough to leave.

\u0026lt;port> 8000 \u0026lt;/ port>

This is the port that will emit. Usually no need to change the port unless you have firewall restrictions or something.

\u0026lt;logdir> / home / user / icecast / logs \u0026lt;/ logdir>
\u0026lt;webroot> / home / user / icecast / web \u0026lt;/ webroot>
\u0026lt;AdminRoot> / home / User / icecast / admin \u0026lt;/ AdminRoot>

These three lines tell the icecast to store your records, where the files panel and web interface where the files panel web interface management . Here I have placed the routes that would use you too if you followed the tutorial, remember to change user by username.

Ok, in theory everything is ready to run Icecast. Now to try it. Running Icecast

Well, now prove that everything is working, run this command: $

icecast2-c icecast.xml

If the console does not throw any error then Icecast is already running, now will check the logs and web interface to see that everything is going well.

note: The console will block the Icecast NOT go to the console or you will close down the server, leave it there, open, open another console window or tab to make the steps that follow.

While in our home run: $

cd cd icecast
$ logs
$ cat error.log

You should see something like this:

[05/22/2010 13:08:33 ] INFO main / main Icecast
2.3.2 server started [22/05/2010 13:08:33] INFO yp / yp_update_thread YP update thread started
[22/05/2010 13:08:33] INFO connection / SSL capability get_ssl_certificate

not does not matter if the log is somewhat different, in reality what matters is that there are no errors and you see the line that says server started

now see the server status through the web interface. To do this on a browser go to http://localhost:8000/ address this we must make a server status page. Remember to enter the administration section you should enter the user name and password you specified in \u0026lt;admin-user> \u0026lt;/ admin-user> and \u0026lt;admin-password> \u0026lt;/ admin-password>

Ices

Prepare Well you already have a server running and ready to accept connections, however you still can not listen to music, basically because you have not told Icecast that play music. It's actually a bit more complicated, see:

Icecast streaming server is the charge of accepting requests entratentes and distribute the medium to the listeners that are connected but do not know anything about music or playlists, it handles the program which is called source (source). There are several different sources for Icecast including the most basic is the Ices developed by the same people who developed the Icecast but you can also use different sources if you prefer, such as VLC Player can act as a source for Icecast .

For this tutorial we will use as source for Ices and Icecast is easy and quick to configure. As with the Icecast create a directory structure in the home to organize files. Esanda in the home run: mkdir

$
$ cd ices ices
$ mkdir conf $
mkdir mkdir playlists
$ logs

Now copy the default configuration file for use with Ices playlists. Remember if you can not find the file to your command to locate find.

$ cd conf cp
$ / usr/share/doc/ices2/examples/ices-playlist.xml ices.xml
$ kate ices.xml

Now edit the configuration file Ices. Remember that we will in the order in which the lines appear in the file so pay close attention to keep going.

\u0026lt;logpath> / home / user / ices / logs \u0026lt;/ logpath>

This line tells Ices to save log files. Remember to replace user with your username.

\u0026lt;name> Example stream name \u0026lt;/ name>
\u0026lt;Genre> Example genre \u0026lt;/ genre>
\u0026lt;descriptione> A short description of your stream \u0026lt; / description>

These three lines contain the metadata of the station. It would be a good idea filled them with the correct data as the name of your station, gender and description. \u0026lt;param

name= "file" > / home / user / ices / playlists / PLAYLIST.TXT \u0026lt;/ param>

This line tells the Ices where find the playlist file. Later I will tell you how to create the playlist. Remember to replace user with your username

\u0026lt;param name= "random" > 0 \u0026lt;/ param>

This line tells the Ices if you play the playlist in sequence or randomly. Set it up to you the value you want. If you put in 1 Ices random entries will be playing

\u0026lt;param name= "once" > 0 \u0026lt;/ param>

This parameter tells whether to play Ices Playlist only once or be touched countless times. If you leave the value to 1 Ices will play the playlist once and when done close the connection to the server and end making the station can no longer hear more. If you plan to leave the station running all day for people to connect anytime you should set the value to 0 so that the cycle indefinitely Ices playlist.

\u0026lt;hostname> localhost \u0026lt;/ hostname>
\u0026lt;port> 8000 \u0026lt;/ port>
\u0026lt;password> hackme \u0026lt;/ password>
\u0026lt; mount> / example1.ogg \u0026lt;/ mount>

This is the server information. Here we put the information Icecast server through which we will issue. This information must match the information we had already set in the icecast.xml. in \u0026lt;password> \u0026lt;/ password> put the password we had put into the label \u0026lt;source-password> \u0026lt;/ source-password> of icecast.xml

\u0026lt;mount> In , \u0026lt;/ mount> we choose the mount point you want to broadcast. The mount point will be the end of the URL you use to listen to the station so it should not be exmaple1.ogg could give listen.ogg place or maybe something more descriptive but should not contain spaces and MUST end in. ogg because it is the codec used to Icecast and Ices issue if not put the. ogg some players will be left hanging without doing anything when trying to listen to the station.

\u0026lt;nominal-bitrate> 64000 \u0026lt;/ nominal-bitrate>

Is the last configuration, but an important one. Defines the bit rate at which issue your station. The higher the bit rate best audio quality but more bandwidth you need to keep all listeners connected. If you put more speed in bits that can support your channel to the number of listeners you expect the audience began to experience cuts in music or worse spontaneous disconnections.

If you are not sure that leaves the bitrate to use default bitrate is 64 kbps is a good quality for him. Ogg at least for most applications. To learn more about how to calculate the bandwidth you need to read the box below, but saltalo.

Calculating the bandwidth

If you're not sure how to know how many listeners can support your channel or what the maximum bitrate you can use without your listeners experience problems this section will give you some light on this subject:

Concurrent band width

The bandwidth is the extent of concurrent channel you need to broadcast. It is calculated as follows:

cb = b * n Where

cb is the bandwidth concurrently (in kbps), b is the bitrate that issue (kbps) and n the number of listeners who expect to be connected simultaneously. For example, if you're going to broadcast at 128kbps, and expect 50 simultaneous listeners: cw = 128kbps * 50 = 6400 kbps. So they need a channel of 6.4 mbps to support 50 simultaneous listeners at 128kbps if you emit

Traffic Limit

Some servers impose a limit on monthly traffic and when you go above or begin to charge most are either not let you cast more for the rest of the month. To see if your monthly limit is sufficient to support the station can be calculated as:

tb = b * n * at * 30 Where

tb is the total bandwidth of the month (in kbits ) b is the bitrate to be issued (in kbps), n is the average number of listeners per day and waiting at is the average amount of time that a listener will be connected to the day (in seconds).

So if issued at 128kbps, wait 50 listeners daily and each will be connected on average 5 hours a day listening to the station will have:

tb = 128 * 50 * 18000 * 30 = 402.33 GB

You will need a monthly traffic limit of at least 400 GB

Ok, you're ready to set Ices, now to create the playlist.

Create Playlist

The Playlist is just a file where each line is the path to a file. ogg, eg

/ home / user / music / anime / yui - rolling star.ogg
/ home / user / music / anime / boa - every heart.ogg
/ home / user / music / anime / gumi - catch you catch me.ogg
/ home / user / music / anime / porn graffiti - melissa.ogg

may be a bit cumbersome to create the list hand so you can use the find command to expedite the work, for example: $

find / home / user /-name "*. ogg"> PLAYLIST.TXT

This command will write to a file called PLAYLIST.TXT all. ogg find the folder / home / user / recalls again replace user your username. Ices Run

As you have prepared your playlist (which you have saved in / home / user / ices / playlists / PLAYLIST.TXT) you can start the ices. To do this you do the following while in your home: $

cd cd ices
$ conf $ ices2 ices.xml

Ok, if all goes well the console should display error messages, if so, the ices already running and sending data to Icecast media. Again, the console will be locked NO close the console or come down to Ices open another console window or tab to the next steps.

We will verify the status of Ices, for it, from our home:

$ cd cd ices
$ logs
$ ices.log

cat should see something like this:

[22/05/2010 18:20:55] INFO ices-core/main started Ices 2.0.1 ...
[22/05/2010 18:20:55] INFO Requested
signals/signal_usr1_handler Metadata update [22/05/2010 18:20:55] INFO playlist-basic/playlist_basic_get_next_filename Loading playlist from file "/ home / sergio / ices / playlists / PLAYLIST.TXT "
[22/05/2010 18:20:55] DBUG playlist-basic/shuffle Has-been shuffled
Playlist [22/05/2010 18:20:55] INFO playlist-builtin/playlist_read Currently playing "/ home / sergio / Music / J-Music / YUI / From Me To You/11.ogg"
[ 5/22/2010 18:20:55] INFO stream / ices_instance_stream Connected to server: localhost: 8000/yui.ogg
[22/05/2010 18:20:55] DBUG Reencoded / reencode_page Reinitialising Reencoded for new logical stream
[22/05/2010 18:20:55] INFO encode / Encoder initialising in VBR encode_initialise mode: 2 channels, 44100 Hz, nominal

128000 Basically what you should look for is a line like [22/05/2010 18: 20:55] INFO playlist-builtin/playlist_read Currently playing "/ home / sergio / Music / J-Music / YUI / From To me You/11.ogg " that tells you Ices read and began broadcasting one of the files you put in the playlist.

can also check the status of the server from the web interface going to http : / / localhost: 8000 there is to receive the mount point you configured with the metadata that you placed in the file.

Play Station

Ok, finally the moment you have been waiting for. Listen to the music the station broadcasts. You can do this, for example with VLC Player:

Middle menu select Open Network Stream, in the box type in the address: http://localhost:8000/ Mount.ogg ( mount.ogg replaces the mount point you've placed in \u0026lt;mount> \u0026lt;/ mount> ices.xml on file) and then click the Play button.

If all goes well the music you listen to radio broadcasts. Cards! Stop

issue Ok. I will tell you how to stop the broadcast. Remember when we open consoles Ices and Icecast well, for you simply stop issuing press CTRL + C on the console to stop the programs. The best practice, of course, is that the first stop and then Ices Icecast because if you do it the other way round Ices unexpectedly lose connection to the server which is not recommended.

as not to block the console

is possible to run Icecast and Ices without the console is locked. To do this you run the commands by adding an ampersand (&) at the end as well:

$ icecast2-c icecast.xml &
$ ices2 ices.xml &

In doing so the system will respond with something like this:

[1] 2923

That number is the pid (process id) of Icecast is number identifies the process in the system and the need to stop the issue later. If you lose number or the station has been broadcasting for a long time and I do not remember you can retrieve it using the command: $

ps ax does not kill him forcibly. When you do see that the system responds with something like this: [1] + Done icecast2-c icecast.xml
So you know that the process is complete. Useful tools

Mp3 to ogg


When setting up a radio station with Icecast and Ices one of the first questions that arises is: How do I convert an Mp3 to ogg? The answer is very simple for our comfort, to convert a mp3 to ogg on Linux just a console command but first make sure you have installed these packages if you do not already have:

$

sudo apt-get install mpg321 vorbis-tools Now to convert to mp3 ogg:
music.mp3
$ mpg321-w - huge people moving around the city:

because of the mess that they put together could not go to my Astronomy class. Damn, Bogotá has the worst urban service buses are dirty, unsafe, they do what they want, stop where they please and still complain. And besides all make stupid stoppages that disrupt the normal order around the city.

Nothing, hopefully not to yield to their demands, before they put more taxes to pay for what they did today, that there was chaos in the city now has no excuse. Learn to provide good service and then if Complain.

0 comments:

Post a Comment