Broadcasting your rhythmbox in ubuntu 11.10
Once I decided to setup my rhythmbox broadcasting into local network (so my wife or home media player could connect and listen), and didn’t find any comprehensive guide, so I decided to write my own when I managed to configure it.
I found a couple rhythmbox plugins for that, but they didn’t work for me, so I stopped on icecast
plus darkice
.
Installing and configuring icecast
Icecast is free server software for streaming multimedia. We will use it to create streaming server on localhost.
Installation
sudo aptitude install icecast2
Configuration
- Open the file
/etc/icecast2/icecast.xml
as root and change all passwords inauthentication
section. You will usesource-password
to connect darkice andadmin-password
for admin web-interface. - Change
hostname
parameter if you want to stream over the internet, or just leavelocalhost
for local network. - To enable icecast daemon, change flag to
ENABLED=true
in/etc/default/icecast2
file.
Icecast will run on port 8000 (configurable), so you can access admin interface by this url: http://localhost:8000
You can start and stop icecast server using following commands
sudo /etc/init.d/icecast2 start
sudo /etc/init.d/icecast2 stop
Note: if you (like me) don’t want icecast2 to be started automatically, you can disable it:
sudo update-rc.d icecast2 disable
Installing and configuring darkice
DarkIce is a live audio streamer. It records audio from an audio interface (e.g. sound card), encodes it and sends it to a streaming server.
Installation
sudo aptitude install darkice
Configuration
-
Copy example darkice configuration to your home folder:
cp /usr/share/doc/darkice/examples/darkice.cfg ~/
-
Open
~/darkice.cfg
in your favourite editor and configure like this:[general] duration = 0 bufferSecs = 1 reconnect = yes [input] device = pulse sampleRate = 44100 bitsPerSample = 16 channel = 2 [icecast2-0] bitrateMode = cbr format = vorbis bitrate = 320 server = localhost port = 8000 password = <your-icecast-source-password> mountPoint = sample.ogg name = sample
Note: change
<your-icecast-source-password>
to source-password from youricecast.xml
I’m using Ogg Vorbis stream here, but you also can use mp3 stream just change
format
fromvorbis
tomp3
andmountpoint
tosample.mp3
. -
Run darkice
sudo /etc/init.d/icecast2 start sudo darkice -c ~/darkice.cfg
After that you can connect your clients to url: http://<your-ip>:8000/sample.ogg
and they will hear your pulseaudio input.
Streaming your pulseaudio output instead of input
As I said, after all steps above are completed, your clients will hear your input (microphone or line-in) instead of your output. You have several choices here:
- Connect your input to your output via audio cable. Most simple, but less flexible solution. No other instruction required for that.
- Configure pulseaudio to redirect all your output to darkice input.
- Install pavucontrol
sudo aptitude install pavucontrol
- Ensure you are running
icecast2
anddarkice
as described above - Launch
pavucontrol
GUI - Open the ‘Recording’ tab
- Find
ALSA plugin [darkice]:
and change it’s source toMonitor of <your-sound-source>
using button near speaker icon - That’s it, connect your clients to
http://<your-ip>:8000/sample.ogg
- Configure pulseaudio to redirect just your rhythmbox (or other player’s) output to darkice. This is what I’ve chosen because I keep all my other sounds in my laptop speakers and stream only music played by rhythmbox. But this will work only if you have several output sources like me (I have main output and HDMI output through my videocard)
- Install pavucontrol
sudo aptitude install pavucontrol
- Ensure you are running
icecast2
anddarkice
as described above - Launch
pavucontrol
GUI - Open the ‘Recording’ tab
- Find
ALSA plugin [darkice]:
and change it’s source toMonitor of <your-secondary-source>
using button near speaker icon (I’ve chose HDMI here) - Open the ‘Playback’ tab
- Find
Rhythmbox section
(rhythmbox should be running) and change and change it’s destination to ‘’ using button near speaker icon (I’ve chose HDMI here) - That’s it, connect your clients to
http://<your-ip>:8000/sample.ogg
That’s it.