Streaming Audio with Ices and Icecast
The Sioux Empire Amateur Radio Club operates a repeater on 146.895MHz with the call name W0ZWY. On Tuesday evenings, it provides a time for club announcements. I like to listen in when I can, but sometimes I am still at work when the announcements start and can't get to my radio. I found a way to solve this problem by using a UHF/VHF scanner, Linux, Ices and Icecast. By rebroadcasting the transmission over the Internet, I can listen to the local club repeater anytime, anywhere.
The first step was to find a VHF tuner that could tune to 146.895MHz and output analog audio to a sound card. I found that the least expensive way to go was to buy a consumer-grade UHF/VHF scanner. The scanner needed to have either a line-level output or a headphone jack. I found that line-level outputs are rare, but there are a number of scanners with headphone jacks. I also wanted one with a digital tuner so that it would not drift off frequency over time. I found a Radio Shack PRO-2050 on eBay for around $75 US that met all my requirements.
Using an F-to-BNC adapter, I connected the scanner's antenna jack to the off-air TV antenna on the roof of my house. This worked well because 146.895MHz lies right between off-air TV channels 6 and 7. I spent some time setting the squelch as high as I could, so there would not be static when no one was transmitting. Figure 1 shows my scanner with the audio cable plugged in to the headphone jack.
In order to put the audio on the Internet, it first must be encoded. Then, that encoded information can be made available for streaming to clients on the Internet. For these tasks, Icecast and Ices make a great team. Icecast is a media streaming program that supports Ogg Vorbis or MP3 streams. It receives encoded media from one or more sources and makes it available for streaming to multiple clients. Ices is an Ogg Vorbis audio encoder that works well with Icecast. I chose Ogg because it is a patent- and royalty-free format. Plenty of players can decode Ogg. XMMS on Linux and Winamp on Windows are the most common. If you are interested in using MP3 encoding, check out LiveIce by following the link in the Resources for this article.
The encoding and streaming tasks can be done on the same machine, but I chose to do them on separate machines. This makes it easier to add more sources later. Additionally, it removes some of the processing burden from the streaming machine.
For the encoding computer, I chose a 233MHz Pentium I computer that had been unused for many years. I connected the headphone jack from the scanner to the line-in jack on the sound card using a 3.5mm-to-3.5mm audio cable that came from an old set of computer speakers. I connected the network interface to my LAN and set the IP address to 192.168.1.21.
For the streaming computer, I chose to use my existing router, which doubles as a Web server. The main reasons I chose it are that I already own it and it has my only public IP address. This computer has two network interfaces. One is connected to my cable modem and has a public IP address. The other interface is connected to my LAN and has the private IP address 192.168.1.1. Another way to accomplish this would be to use a consumer-grade cable/DSL router and forward port 8000 to the streaming computer's IP address.
Figure 2 shows a diagram of my network, including the scanner, encoder, streamer and cable modem.
My streaming computer is running Mandriva. Icecast is available from Mandriva's contrib RPM repository. Once I added that repository, installing Icecast was as easy as typing urpmi icecast from the command prompt. If you want to install from source, you can download the latest release from the Icecast Web site (see Resources). Simply click the download link, extract the archive, and run the familiar commands ./configure; make; make install.
The Icecast configuration file is an XML file and usually resides in /etc/icecast.xml. I was able to use most of the default settings, but I highlight some of the changes I did make here.
The limits section of the file allows you to set the maximum number of source streams (encoders) and the maximum number of clients that can connect to the streaming computer at once. The upload data rate on my cable modem is limited to 256Kbps by my ISP. As such, I need to limit the maximum number of clients to be sure that I don't use all of my upload bandwidth:
<limits> <clients>10</clients> <sources>2</sources> </limits>
The authentication section is where you specify the user names and passwords. The source-password is the password used by the encoding machine when it connects. The relay-password is used by relays, which I am not using in my configuration. The admin-user and admin-password allow access to the administration Web page. It is important to change all passwords from the default for security:
<authentication> <source-password>hackme</source-password> <relay-password>hackme</relay-password> <admin-user>admin</admin-user> <admin-password>hackme</admin-password> </authentication>
The hostname is used so that Icecast knows what address to append to the beginning of the links on the Web page:
The listen-socket allows you to set the port on which Icecast listens; 8000 is the default:
<listen-socket> <port>8000</port> </listen-socket>
Once the configuration file is all ready, you can start Icecast by running the init script: /etc/init.d/icecast start. If there are any errors during startup, look in the log files to debug them.
|Speed Up Your Web Site with Varnish||Jun 19, 2013|
|Non-Linux FOSS: libnotify, OS X Style||Jun 18, 2013|
|Containers—Not Virtual Machines—Are the Future Cloud||Jun 17, 2013|
|Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer||Jun 12, 2013|
|Weechat, Irssi's Little Brother||Jun 11, 2013|
|One Tail Just Isn't Enough||Jun 07, 2013|
- Speed Up Your Web Site with Varnish
- Containers—Not Virtual Machines—Are the Future Cloud
- Linux Systems Administrator
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Senior Perl Developer
- Technical Support Rep
- Non-Linux FOSS: libnotify, OS X Style
- UX Designer
- RSS Feeds
- It is quiet helping
57 min 20 sec ago
1 hour 14 min ago
- Reachli - Amplifying your
2 hours 30 min ago
3 hours 19 min ago
- good point!
3 hours 22 min ago
- Varnish works!
3 hours 31 min ago
- Reply to comment | Linux Journal
4 hours 1 min ago
- Reply to comment | Linux Journal
6 hours 27 min ago
- Reply to comment | Linux Journal
10 hours 26 min ago
- Yeah, user namespaces are
11 hours 43 min ago
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?