LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


Streaming Media With Linux, Part 2
Pages: 1, 2, 3

The start-up messages also report any errors from a misconfigured rmserver.cfg file. Configuration details are available in the RealServer documentation (in RealAdministrator/Docs) and in the RealNetworks release guide. That information can be most helpful: Thanks to the error report and the documentation, I learned that I needed to add this IP binding before the server could start:



<!--              IP BINDINGS               -->
<List Name="IPBindings">
  <Var Address_01="0.0.0.0"/>
</List>

I also needed to set the CPU count with this block:

<!-- S Y S T E M -->
<Var ProcessorCount="1"/>

That setting required a command-line flag, as did a bypass for an error with my /etc/hosts file. At last, I had my working command sequence to launch RealServer:

Bin/rmserver rmserver.cfg --sct --iehp &

Once your server is running, point your browser to the RealServer administration account via the loopback URL:

http://localhost.localdomain:26122/admin/index.html

The admin port number is a random number assigned during installation. See your rmserver.cfg file for the correct value for your admin port.

From here you simply point and click your way through the server's administrative tools. The GUI is well-designed (Figure 9), help files are a click away, and the experience is totally painless. Alas, we don't have the space here to fully explore RealAdministrator, but I must commend RealNetworks for the obvious effort put into this excellent tool.

Screen shot.
Figure 9. RealAdministrator in Netscape.

Fortunately, you can safely accept most of RealAdministrator's default values and move on towards our goal of producing and transmitting a streaming RealAudio broadcast; however, you should look at and understand the information regarding the server's mount points. Under the Configure topics, click on General Setup, then click on Mount Points (Figure 10).

Screen shot.
Figure 10. Mount point description in RealAdministrator.

The base path indicated here is the path to your SMIL files, the point for requests from network clients for the audio stream. You can now verify the server's operation by opening RealPlayer and entering this URL in the File/Open Location dialog box:

rtsp://127.0.0.1/my_mix.smil

This URL assumes the existence of my_mix.smil at the mount point seen in Figure 10 and tests it via your local host loopback address (127.0.0.1). If the requested file is valid and is located at the configured mount point (/usr/local/realserver/Content is the default path), RealPlayer will pop up and begin streaming the first audio source in the SMIL list.

Once you have verified the server's correct operation, you're ready for network broadcasting. Open rmserver.cfg and change all references to localhost.localdomain (or 127.0.0.1) to your actual IP address. Do the same for your SMIL files, then restart your server with the new configuration. For my first network broadcasts, I changed the audio source settings in my_mix.smil from this address:

audio src="rtsp://127.0.0.1/4_LPC_Studies.ra"

to this one:

audio src="rtsp://64.108.112.104/4_LPC_Studies.ra"

By the way, run /sbin/ifconfig to determine your IP address:

ppp0 Link encap:Point-to-Point Protocol
inet addr:64.108.112.104 P-t-P:64.108.112.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:2100 errors:0 dropped:0 overruns:0 frame:0
TX packets:2142 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3

You will want the value for the inet addr, not for P-t-P. Also, note that I would now open my RealAdministrator with this URL:

http://64.108.112.104:26122/admin/index.html

Obviously, a static IP address is preferable: You enter the address once and leave it. Unfortunately , my address is dynamically assigned, so I need to change it in my server configuration and my SMIL files. I suppose a nice PERL script could take care of all that automatically, but I'll leave that problem for the more resourceful reader.

Regardless of how you update your IP address, you still need a way for people to connect with your server. Easily accomplished by adding this kind of tag to your Web page:

<a href=my_new.ram>My RealAudio Playlist</a>

The RAM (RealAudio Metafile) format is a simple text file containing the address of your SMIL file. Using my IP address du jour again, here's my own my_mix.ram:

rtsp://64.108.112.104/my_mix.smil

RAM files should be located at the same site as the Web pages containing them. Now clients can connect to your server via Web links or by entering URLs into RealPlayer's File/Open Location dialog box. You can also configure your links to call and stream to a browser's RealPlayer plug-in, but I leave that procedure as another exercise for the diligent student. If you made it this far, then congratulations are in order: You have successfully installed, configured, and deployed RealServer for streaming your media to the Internet.

Icecast

Icecast is a free open source streaming server licensed under the GPL. It is easy to install, configure, and use, making it possible for anyone with sufficient software and hardware resources to become an instant Internet broadcaster. Icecast 1 supports streaming MP3s and M3U playlists, and version 2 supports streaming Vorbis files. That news should come as a welcome relief to broadcasters concerned about the eventuality of having to pay Fraunhofer for streaming MP3s over the Internet. Vorbis players and plug-ins exist now, with many more on the way, but Icecast 2 is the first streaming Vorbis server. We'll look at both versions of Icecast, starting with version 1.

Streaming MP3 with Icecast 1

Download the latest version of Icecast 1 from the link above into your $HOME directory and unpack it with tar xzvf icecast-1.3.8.beta2. Move into your new Icecast directory and run ./configure --help to look at your compile-time configuration options. Finally, run ./configure with your selected options, then make and (as root) make install. You will also want to download and build the shout utility available from the Icecast site. Unpack and build it following the directions for Icecast.

The Icecast installation will create a /usr/local/icecast hierarchy for its default directory path. The conf and etc directories are of particular importance: They are the default locations for your server and streamer configuration files and your M3U playlists. As with RealServer, your configuration files will need such information as your IP address, server port number, connection limits, and so forth. Complete configuration instructions can be found in the README and INSTALL files for shout and Icecast.

Let's prepare an M3U playlist for the shout streamer. M3U files are simple text files listing absolute paths to your MP3s. For instance, here's a section from my test playlist for this example:

# playlist_01.m3u
/mnt/dosc/soundfiles/mp3/classical/medieval/Carmina_Burana-Fas_et_nefas.mp3
/mnt/dosc/soundfiles/mp3/classical/modern/Cage-In_a_Landscape.mp3
/mnt/dosc/soundfiles/mp3/jazz/Eric_Dolphy-Oleo.mp3
/mnt/dosc/soundfiles/mp3/pop/misc/Aphex_Twin-Xtal.mp3
/mnt/dosc/soundfiles/mp3/pop/misc/Soft_Machine-Moon_in_June.mp3

The playlist is declared in the conf/icecast.conf file. When you have edited your playlist and configuration files, you can start the server by running 'icecast' in an open xterm. You'll see some messages like these:

Icecast Version 1.3.8.beta2 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...
[01/Mar/2001:16:33:48] Icecast Version 1.3.8.beta2 Starting..
[01/Mar/2001:16:33:48] Starting Admin Console Thread...
-> [01/Mar/2001:16:33:48] Starting main connection handler...
-> [01/Mar/2001:16:33:48] Listening on host 127.0.0.1...
-> [01/Mar/2001:16:33:48] Listening on port 8000...
-> [01/Mar/2001:16:33:48] Listening on port 8001...
-> [01/Mar/2001:16:33:48] Using 'localhost.localdomain' as servername...
-> [01/Mar/2001:16:33:48] Server limits: 10 clients, 5 clients per source, 10 sources, 5 admins
-> [01/Mar/2001:16:33:48] WWW Admin interface accessible at http://localhost.localdomain:8000/admin
-> [01/Mar/2001:16:33:48] Starting Calender Thread...
-> -> [01/Mar/2001:16:33:48] Starting UDP handler thread...
-> [01/Mar/2001:16:33:48] [Bandwidth: 0.000000MB/s] [Sources: 0] [Clients: 0] [Admins: 1] [Uptime: 0 seconds]
-> [01/Mar/2001:16:33:48] Starting relay connector thread...
->

As with our RealServer example, we're testing Icecast on the loopback address before broadcasting to the network. Now we want to send an MP3 stream to the server:

[root@localhost shout-0.8.0]# ./shout localhost -P itsme
Shout version 0.8.0 - www.icecast.org

Connected: [localhost:8000\default]

[/mnt/dosc/soundfiles/mp3/jazz/Eric_Dolphy-Oleo.mp3]
[7:38] Size: 7337522 Bitrate: 128000 (94070 bytes/dot)

The server acknowledges the connection:

-> [01/Mar/2001:16:38:35] Accepted encoder on mountpoint /default from localhost.localdomain. 1 sources connected

Pages: 1, 2, 3

Next Pagearrow




Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!


Linux Resources
  • Linux Online
  • The Linux FAQ
  • linux.java.net
  • Linux Kernel Archives
  • Kernel Traffic
  • DistroWatch.com


  • Sponsored by: