A quick howto for setting up liquidsoap to create your own online radio station and transmit using the efficient and awesome AAC+ audio codec. I’ve made it super simple to create an encoder that can take program audio and create an AAC+ encoded stream that you can send to one or more icecast distribution servers – to broadcast around the world! Read on:
Install an up to date OS (as of this writing, Ubuntu 20.04 is what I used). Just the bare command line only server install is all you need. You could even do this on a Raspberry Pi with a USB audio pickup and then connect your program audio from the output of your processed audio chain. Installation is quite simple by following these commands:
sudo apt install opam screen
opam init
opam switch create 4.10.0
opam depext taglib mad lame ffmpeg vorbis cry samplerate ocurl liquidsoap fdkaac alsa
opam install taglib mad lame ffmpeg vorbis cry samplerate ocurl liquidsoap fdkaac alsa
sudo ln -s ~/.opam/4.10.0/bin/liquidsoap /sbin/liquidsoap
Answer Yes to any yes/no prompts, and once complete, you will have a working copy of liquidsoap with full AAC+ support. Now that liquidsoap is installed, you can now create a .liq file to set the parameters of your stream. Once you create this file, launching your stream becomes quite simple. Here’s an example .liq file. You can change any of the parameters to suit your needs:
set("log.file.path","/tmp/basic-radio.log")
input = mksafe(input.alsa())
output.icecast(
%fdkaac(channels=2, samplerate=44100, bandwidth="auto", bitrate=96, afterburner=true, aot="mpeg4_he_aac_v2", transmux="adts", sbr_mode=false),
host="my.icecast.host",
port=8000, password="my.P@ssw0rd", genre="live",
description="LIVE", mount="/live",
name="MY STATION NAME", user="source",
url="http://my.icecast.host:8000/live", input)
Now that you have your liquidsoap and .liq file installed and ready, simply launch a screen session and invoke the following command:
liquidsoap -v ./myliqfile.liq
You can disconnect from your screen session and the stream should still continue running. To reconnect to your detached screen session, you can simply do: screen -r You can have multiple streams running on the same host by opening more screen sessions and invoking additional liquidsoap instances. If running multiple screens, you can list them by running: screen -ls
How do you turn off parametric stereo in aac+? It sounds funny above 64 KBPS, not really needed.
I figured it out. Replace aot=”mpeg4_he_aac_v2″ with aot=”mpeg4_he_aac”