lar.ven – this.ven's wiki

Authority through knowledge (of FLOSS and GNU/Linux)

User Tools

Site Tools


Streaming setup

Live streaming can be done independently from 3rd parties by using a streaming media server like Icecast and a source client for encoding and streaming to that server.

I'm using Icecast and oggfwd in combination with ffmpeg as source client to realize live streaming concerts at Although there are many official source clients available, oggfwd seems to be the only solution when using JACK and encrypted connections with Transport Layer Security (TLS). Mixing and monitoring is done by ardour, hence the signal flow can be represented like this:

ardour ⇒ ffmpeg ⇒ oggfwd ⇒ icecast ⇒ listener


For this guide a running Icecast advanced configuration and a working FLOSS media studio setup for audio is assumed. General knowledge on how to install software and use a terminal in your GNU/Linux distribution is necessary, too.


Get ffmpeg and oggfwd package by using your distribution's package manager or compile from sources. You also need to have mpv installed to play waiting music as well as wget for triggering tasks via Icecast's Admin Interface.

Set environment

To simply copy and paste the commands used in this guide, set the following environment variables to your needs. Most of the values depend on your Icecast basic setup. This is an example:
export CONCERT_TITLE="My streaming concert"
export ARTIST_NAME="Just me"
export HOSTNAME=""
export PORT="1234"
export SOURCE_PASSWORD="secret-S0URC3-passwd"
export STREAM_MOUNTPOINT="/stream.ogg"
export FALLBACK_MOUNTPOINT="/greeting.ogg"
export AUDIO_FILE="/path/to/waiting_music.ogg"
export ADMIN_USERNAME="admin"
export ADMIN_PASSWORD="@dmin-P4SSW0RD"

Session preparation

Create or open an ardour session to route, control and mix physical inputs as well as pre-recorded tracks, if any. Setup your session: Level gains, pan tracks and apply effects as you wish, but keep in mind to save some resources for encoding. If a recording is desired, it's enabled in transport bar and tracks are armed, too.

Start source streaming

The actual source streaming happens when ardour's output is encoded by ffmpeg and piped to oggfwd, which sends the stream to Icecast for distribution to listeners.

Encode and forward

The output of ardour must be encoded to Ogg Vorbis container format and provided at stdout to be forwarded by oggfwd. This can be achieved by using ffmpeg's JACK input device as well as audio encoding parameters and piping to oggfwd using the | operator:
ffmpeg -f jack -i ffmpeg -vn -acodec libvorbis -b:a 192k -minrate 192k -maxrate 192k \
-metadata title="$CONCERT_TITLE" -metadata artist="$ARTIST_NAME" -f ogg -y /dev/stdout |

ffmpeg parameters:

Connect JACK clients

Use another terminal to connect ardour's master outputs to ffmpeg:input_1 and ffmpeg:input_2 within JACK:
jack_connect "ardour:Master/audio_out 1" ffmpeg:input_1
jack_connect "ardour:Master/audio_out 2" ffmpeg:input_2

Saving time

When setting up those things all by yourself, it might be necessary play waiting music immediately after the source streaming started to save time. I'm using mpv with JACK audio output driver, auto-connecting to ffmpeg and looping the file $AUDIO_FILE in another terminal:
mpv --ao=jack --jack-port=ffmpeg --loop-file=inf $AUDIO_FILE

Press the m key when starting the concert to mute mpv's output and press Play button in ardour's transport bar to start recording, if any.

Controlling listeners

Icecast's Admin Interface offers some functions to control listeners. I'm using wget to trigger those tasks at the terminal. General syntax is:

wget --quiet --output-document=/dev/null --http-user=$ADMIN_USERNAME \
--http-password=$ADMIN_PASSWORD https://$HOSTNAME:$PORT/admin/$WGET_URI

wget parameters:

The value of $WGET_URI depends on specific task.

Move listeners from fallback

The fallback mountpoint is activated since Icecast is running and listeners might have connected before the actual source stream started. To move listeners from one mountpoint to another, execute:
export WGET_URI="moveclients.xsl?mount=$FALLBACK_MOUNTPOINT&destination=$STREAM_MOUNTPOINT"
wget --quiet --output-document=/dev/null --http-user=$ADMIN_USERNAME \
--http-password=$ADMIN_PASSWORD https://$HOSTNAME:$PORT/admin/$WGET_URI

Kill fallback streaming

It's useful to kill fallback streaming for misbehaving listener clients afterwards:
export WGET_URI="killsource.xsl?mount=$FALLBACK_MOUNTPOINT"
wget --quiet --output-document=/dev/null --http-user=$ADMIN_USERNAME \
--http-password=$ADMIN_PASSWORD https://$HOSTNAME:$PORT/admin/$WGET_URI

Stop source streaming

At first mpv's output is unmuted by pressing m to indicate the end of the concert. Then listener's will be moved back to fallback mount and source streaming is killed:
export WGET_URI="moveclients.xsl?mount=$STREAM_MOINTPOINT&destination=$FALLBACK_MOUNTPOINT"
wget --quiet --output-document=/dev/null --http-user=$ADMIN_USERNAME \
--http-password=$ADMIN_PASSWORD https://$HOSTNAME:$PORT/admin/$WGET_URI
export WGET_URI="killsource.xsl?mount=$STREAM_MOUNTPOINT"
wget --quiet --output-document=/dev/null --http-user=$ADMIN_USERNAME \
--http-password=$ADMIN_PASSWORD https://$HOSTNAME:$PORT/admin/$WGET_URI

Lastly ffmpeg, oggfwd and mpv processes are killed:
killall -9 ffmpeg oggfwd mpv

In ardour, recording is stopped and the session is saved for later production.

Category: FLOSS media studio

floss_media_studio/streaming_setup.txt · Last modified: 2022/09/13 18:35 by this.ven