Skip to content

Instantly share code, notes, and snippets.

@padenot
Last active January 3, 2016 13:59
Show Gist options
  • Save padenot/8473398 to your computer and use it in GitHub Desktop.
Save padenot/8473398 to your computer and use it in GitHub Desktop.
# Setup and packages
```sh
sudo aptitude install icecast2 gstreamer0.10-pulseaudio gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly-multiverse gstreamer-tools pavucontrol
```
Remember the password when setting up `icecast2` (when prompted by the install
script), because we will use it later on.
# Setup pulse
- Get the name of the monitor pulse source (a fake input stream that is in fact
everything that goes out of pulseaudio mixer). Run:
```sh
$ pactl list
```
and look for a section like:
```sh
Source #1
State: SUSPENDED
> Name: alsa_input.pci-0000_00_1b.0.analog-stereo.monitor
Description: Built-in Audio Analog Stereo
Driver: module-alsa-card.c
Sample Specification: s16le 2ch 44100Hz
Channel Map: front-left,front-right
Owner Module: 5
[...]
```
(note the `.monitor` at the end, this is important). We need the name of the source, which is the thing with a > in front. Copy that.
Then we need to make sure the source is not muted (maybe replacing the source
name):
```sh
$ pacmd
Welcome to PulseAudio! Use "help" for usage information.
>>> set-source-mute alsa_output.pci-0000_00_1b.0.analog-stereo.monitor false
>>> exit
```
# Start the broadcast
```sh
gst-launch pulsesrc device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor" \
! audioconvert ! vorbisenc ! oggmux \
! shout2send ip=127.0.0.1 port=8000 password="icecastpassworkd" mount=stream.ogg
```
First line capture your pulse output, second line converts it in vorbis, and
muxes it in an ogg container, third line connects to icecast2, and makes it
available.
# Listen
```sh
$ firefox localhost:8000/stream.ogg
```
and play. Of course any music player that supports ogg/vorbis and remote streams
works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment