realtime audio streamingEncode audio to mp3 in realtime and send it via an Icecast server around the world already sounds nice.
But in combination with a TV card you can reach undiscovered countries ...
Another article described how you can stream the actual TV program
over the network. So you are able to enjoy your TV card from
everywhere with a web browser. But this solution had a fatal disadvantage.
You did not get the audio output, just video.
If you stream the picture of a webcam, the sound would not be important,
but a TV program without audio?
I was not able to NOT think about this because Icecast should support realtime audio streaming.
At least you need an Icecast server to stream into the network. The installation of this server is described in the article " Your own broadcast station: Icecast".
If you wanted to stream audio in realtime (an not already encoded mp3
files) you would need a fast mp3 encoder (we recommend e.g. Lame) and
the program LiveIce, that is part of the Icecast package. But the latest
version should be downloaded from the homepage
LiveIce reads out the line-in channel of your sound card and sends the
data to Lame which encodes the files to mp3 in realtime.
Then the encoded data is send to the Icecast server by LiveIce.
At the same time the TV is read out by bttvgrab and send to the web server (see Webcam without a Webcam).
The nice part is that the different processes can be placed on
different computers and each can be designed to its main work (network
connection, firewall rules, CPU ...) and the services do not
inhibit each other.
As long as you do not want to service a few thousand computers with audio/video but only one or two in your local network you can put all tasks on one machine (i.e. one single PC with a TV and sound card, installed web- and Icecast-server).
The installation of LiveIce does not include any surprises. But before
you installed LiveIce you should install a mp3encoder first. We recommend
to use the encoder Lame because it works well together with
LiveIce. You get this encoder at http://www.sulaco.org/mp3/.
After unzipping it:
>> tar zxvf lame3.87beta.tar.gz -C /tmpyou compile and install the package:
>> cd /tmp/lame3.87/ >> ./configure >> make >> make installThe same procedure has to be done with LiveIce (get it from http://star.arm.ac.uk/~spm/software/liveice.html)
>> tar zxvf liveice.tar.gz -C /tmp >> cd /tmp/liveice >> ./configure >> make >> make installand copy the directory (as root) to /usr/local
>> cp -a /tmp/liveice /usr/localLiveIce can be configured via a frontend. The configuration file is placed in the same directory you start it from, so you switch to /usr/local/liveice
>> cd /usr/local/liveice >> ./liveiceconfigure.tkand set the following options:
- At Server you specify the computer on which the Icecast server is running and to which the audio has to be sent. If you ran Icecast on the computer where the encoder was running, a localhost should be enough.
- Behind Server you specify the port which Icecast waits for the data.
- Behind Password you enter the string which saves Icecast.
- PCM Audio Format should be set to 32000Hz.
- Soundcard has to be enabled. If your card supports Full-Duplex (record and play at the same time) you should activate this option, too.
- As the Encoder you choose LAME3 with a bitrate of 32000.
- Select Soundcard only.
- In the field Executables - Encoder you enter lame
Next you would start the Icecast server (if it has not ran already) in a new terminal typing
>> icecastYou get the following output:
Icecast Version 1.3.0 Starting... 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. [21/Oct/2000:00:47:33] Icecast Version 1.3.0 Starting.. [21/Oct/2000:00:47:33] Using stdin as icecast operator console [21/Oct/2000:00:47:33] Tailing file to icecast operator console [21/Oct/2000:00:47:33] Server started... [21/Oct/2000:00:47:33] Listening on port 8010... [21/Oct/2000:00:47:33] Using [ronny.ziegler.de] as servername... [21/Oct/2000:00:47:33] Max values: 20 clients, 10 clients per source, 10 sources, 5 admins -> [21/Oct/2000:00:47:34] [Bandwidth: 0.000000MB/s] [Sources: 0] [Clients: 0] [Admins: 1] [Uptime: 1 seconds] ->
Icecast waits for a client that sends the data to it.
Now you start LiveIce
>> ./liveiceand should get the output
playlist 0 Initialising Soundcard 16Bit 32000Hz Stereo opening connection to 192.168.1.13 8010 Attempting to Contact Server connection successful: forking process opening pipe!... writing password Setting up Interface Soundcard Reopened For Encoding Input Format: 16Bit 32000Hz Stereo Output Format: 32000 Bps Mpeg Audio IceCast Server: 192.168.1.13:8010 Mountpoint: liveice Name: LiveIce Radio Genre: Live Url: http://www.linuxnetmag.de Description: LiveIce Press '+' to Finish Lvl: L: 5 R: 4
The data is send to the Icecast server by LiveIce. You get this information in a new output line of Icecast:
-> [21/Oct/2000:00:51:58] Accepted encoder on mountpoint /icy_0 from jpsi.ziegler.de. 1 sources connected ->
Choose the source
After starting a mixer (kmix or gmix) you are able to select the record source on your sound card (as far as it supports Full-Duplex):
(SB Live! value - Card)
At the lowest line you can select the Rec. button to choose the source (CD, Line-In or microphone) you want.
In addition to a web browser the receiver side needs a mp3 player. This mp3 player has to be able to contact the Icecast server (e.g. xmms, freeamp, mpg123)
>> mpg123 http://my.server.de:8010Here it is important to specify the correct port number of the Icecast server.
Now you receive the TV video and TV audio wherever you are.
The use and its problems
Next to a TV video and audio submission this method could be used for Internet telephone calls as well, without any special software. A webcam, connected to the TV card, and a soundcard with a connected microphone are a real video-telephone.
The advantage would be that every person who owns a web browser and a mp3 player that supports mp3 streaming (with M$Win e.g. WinAMP), you get video and audio at once. Even with Linux this solution works and you do not need to change to M$Win and use its NetMeeting any longer.
For a real video telephone both sides need a Full-Duplex sound card, so you can install the TV and audio server on both.
Of course this solution owns a few problems. The most disturbing thing might be the missing synchronization of video and audio.
The realtime encoding as well as the play of the mp3 stream
(due to the buffering) delay the audio output. So the audio is always
delayed with respect to the video.
If the video is refreshed every few seconds this effect will not disturb but if you reach read video steaming with 20 pictures per second in you local network this delay will be awful.
Someone (maybe you) could solve this if the video signal would be delayed by the same time. But the delay depends on the used mp3 player and so the delay has to be set on the client not on the server.
A solution might be a Java applet that delays the video signal by a set time but this would expand this article too much.
If someone knows anything with this function (and/or also a Java mp3 player) he should contact us.
|Your own broadcast station: Icecast||Installation and Configuration of an Icecast server|
|Webcam without a Webcam||How do you stream a TV program over the network? Read here!|
|http://www.sulaco.org/mp3/||Homepage of the MP3 encoder Lame|
|http://star.arm.ac.uk/~spm/software/liveice.html||Homepage of LiveIce|
|http://www.icecast.org/||Homepage of Icecast|
Enter Own Comment