# Lines starting with # are comments, they are ignored.
settings.server.socket.set(true)
settings.server.socket.path.set("/home/per/webradio/liquidsoap/main.sock")
settings.server.socket.permissions.set(440)
settings.server.timeout.set(-1.)
settings.harbor.ssl.certificate.set("/home/per/liquidsoap-daemon/certs/cert.pem")
settings.harbor.ssl.private_key.set("/home/per/liquidsoap-daemon/certs/privkey.pem")
settings.decoder.file_extensions.gstreamer.set(["wmv", "avi", "mp4", "3gp", "webm", "mkv", "wma"])
#settings.gstreamer.debug_level.set(10)
#enable_external_ffmpeg_decoder()
# First find a single file which will be used when the other sources of sound fail:
#default = single("/home/per/ustiusti.mp3")
#default = single("/home/per/Musik/diverse/tyst.flac")
default = single("/home/per/Musik/diverse/Super star by Roller girl-XbIhdEAEE8M.m4a")
# Read raw sound input from a named pipe:
tomtetest = input.external.rawaudio(id="tomtetest", "dd if=/home/per/tomtetest bs=16k 2>/dev/null")
##tomtetest = input.external(id="tomtetest", "dd if=/home/per/tomtetest 2>/dev/null")
# Below is an option to read input from a jack source
## knark = input.jack(id="liquidsoap", clock_safe=false)
# Add a live source. I have a mono microphone, so I convert it to stereo.
# If your live source is stereo, you won't need the audio_to_stereo trick.
# I usually connect to this using Cool Mic as a source client.
live = audio_to_stereo(input.harbor(id="live", replay_metadata=true, "test.ogg", port=8083, password="Nikki_Benz", buffer=1.0))
#live = audio_to_stereo(input.harbor.ssl(id="live", replay_metadata=true, "test.ogg", port=8082, password="Nikki_Benz", buffer=1.0))
jive = amplify(5.0, live)
jive = server.insert_metadata(id="jive", jive)
# Add a live (encrypted) source. I have a mono microphone, so I convert it to stereo.
# If your live source is stereo, you won't need the audio_to_stereo trick.
evil = audio_to_stereo(input.harbor.ssl(id="evil", replay_metadata=true, "tset.ogg", port=8082, password="Nikki_Benz", buffer=1.0))
#evil = audio_to_stereo(input.harbor(id="evil", replay_metadata=true, "tset.ogg", port=8081, password="Nikki_Benz", buffer=1.0))
ejiv = amplify(5.0, evil)
ejiv = server.insert_metadata(id="ejiv", ejiv)
# Mopidy input
# mopidy = input.harbor(id="mopidy", replay_metadata=true, "mopidy.ogg", port=8083, password="Nikki_Benz", buffer=1.0)
# Add bakfickan
# bakfickan1 = audio_to_stereo(input.harbor(id="bakfickan1", "bakfickan1.opus", port=8083, password="Nikki_Benz", buffer=1.0))
#bakfickan1 = audio_to_stereo(input.harbor.ssl(id="bakfickan1", "bakfickan1.opus", port=8082, password="Nikki_Benz", buffer=1.0))
# bakfickan2 = audio_to_stereo(input.harbor(id="bakfickan2", "bakfickan2.opus", port=8083, password="Nikki_Benz", buffer=1.0))
#bakfickan2 = audio_to_stereo(input.harbor.ssl(id="bakfickan2", "bakfickan2.opus", port=8082, password="Nikki_Benz", buffer=1.0))
# bakfickan3 = audio_to_stereo(input.harbor(id="bakfickan3", "bakfickan3.opus", port=8083, password="Nikki_Benz", buffer=1.0))
#bakfickan3 = audio_to_stereo(input.harbor.ssl(id="bakfickan3", "bakfickan3.opus", port=8082, password="Nikki_Benz", buffer=1.0))
# bakfickan4 = audio_to_stereo(input.harbor(id="bakfickan4", "bakfickan4.opus", port=8083, password="Nikki_Benz", buffer=1.0))
#bakfickan4 = audio_to_stereo(input.harbor.ssl(id="bakfickan4", "bakfickan4.opus", port=8082, password="Nikki_Benz", buffer=1.0))
# hakfickan = add([bakfickan1, bakfickan2, bakfickan3, bakfickan4])
# bakfickan = amplify(5.0, hakfickan)
# Add Maxine(?)
# maxine = amplify(5.0, audio_to_stereo(input.harbor(id="maxine", user="maxine", "maxine.opus", port=8083, password="Nikki_Benz", buffer=1.0)))
#maxine = amplify(5.0, audio_to_stereo(input.harbor.ssl(id="maxine", "maxine.opus", port=8082, password="Nikki_Benz", buffer=1.0)))
# Add AK
# ak = amplify(5.0, audio_to_stereo(input.harbor(id="ak", user="ak", "ak.opus", port=8083, password="Nikki_Benz", buffer=1.0)))
#ak = amplify(5.0, audio_to_stereo(input.harbor.ssl(id="ak", "ak.opus", port=8082, password="Nikki_Benz", buffer=1.0)))
# Add Berghem
# berghem = amplify(5.0, audio_to_stereo(input.harbor(id="bergehem", user="berghem", "berghem.ogg", port=8083, password="Nikki_Benz", buffer=1.0)))
#berghem = amplify(5.0, audio_to_stereo(input.harbor.ssl(id="bergehem", "berghem.ogg", port=8082, password="Nikki_Benz", buffer=1.0)))
# rassel = fallback(track_sensitive=false, [live, evil, mopidy, bakfickan1, bakfickan2, bakfickan3, bakfickan4, bakfickan, maxine, ak, berghem])
# output.dummy(fallible=true, rassel)
# Add a playlist
hay = playlist("/home/per/Musik/haylist.txt")
#doors = playlist("/home/per/Musik/The WDoors - Discography (1967 - 1978)")
# In case of shitheads
#nay = playlist("/home/per/Musik/naylist.txt")
#hay = audio_to_stereo(nay)
# You can also add another playlist (or many playlists)
# Local playlist
#lay = playlist("/tmp/TeHÔM.txt")
# Add some sources from the internet. The output.dummy I added
# because it seemed to remove som log file messages which I did
# not think I needed at the time of commenting this script.
kpfa = input.http(max_buffer=90.0, "http://streams.kpfa.org:8000/kpfa_192")
output.dummy(fallible=true, kpfa)
sjrpt = input.http(max_buffer=100.0, "http://http-live.sr.se/p1-aac-96")
output.dummy(fallible=true, sjrpt)
## Attempt to retreive and decode a youtube playlist below.
#tuben = input.external.rawaudio("youtube-dl -x --audio-format best https://youtu.be/oExgKJJMWmg -o - | gst-launch-1.0 fdsrc fd=0 ! decodebin ! audioconvert ! audioresample ! wavenc ! fdsink=fd1")
#tuben = input.external.rawaudio(max_buffer=30.0, "/usr/local/bin/youtube-dl -q -o - -f bestaudio --yes-playlist https://www.youtube.com/watch?v=_mWcBtx7mnQ | /usr/bin/ffmpeg -loglevel quiet -f lavfi -i pipe:0 -acodec pcm_s16le -sample_fmt s16le pipe:1")
#kuben = input.ffmpeg("youtube-pl:https://youtu.be/oExgKJJMWmg")
#output.dummy(fallible=true, tuben)
# Add a second mono sound file, convert it to stereo
# and amplify it.
dorn = single("/home/per/Musik/prat/norn.ogg")
norn = audio_to_stereo(dorn)
porn = amplify(2.0, norn)
## Attempt to relay Echo Moscow
#em = input.http(id="EM", max_buffer=90.0, "https://echomsk.hostingradio.ru/echom64.aacp")
#dem = fallback(track_sensitive=false,[
#(em),
#(befault)])
# Create a source which plays (without letting tracks finish):
# First the raw sound input from the named pipe
radio = fallback(track_sensitive=false,[
(tomtetest),
# If there is no input on the named pipe, play the jack source
# if it is commented out and has input
## (knark),
# If there is no input on the jack source, first play the second
# mono file and switch to the second source from the internet
# at the times mentioned in the switch regardless if the track
# is finished or not. When the time is out for kpfa ...
switch(track_sensitive=false, [({3w8h58m-3w8h59m}, porn), ({3w8h59m-3w10h31m}, kpfa)]),
switch(track_sensitive=false, [({5h55m5s-6h1m30s}, sjrpt)]),
# ... we turn on the first playlist defined which you will
# find if you scroll up in the script. In case the sources
# in the switch above are not available, the script would
# probably have moved on to try the playlist anyway.
(hay),
#doors,
#lay,
# In case the playlist doesn't work for some reason play
# the single file we defined first in the script.
(default)])
# Below some cruft
## radio = random(weights=[5,1],[ radio, gray ])
# Create the source which will output to icecast
# further down in the script. This source will first
# attempt to play the live input I coverted to mono,
# then it will try the procedure starting above
# named "radio".
# Temporary 1
# dingle = playlist("/home/per/Musik/naylist.txt")
# jingle = audio_to_stereo(dingle)
full =
fallback(track_sensitive=false,
# [bakfickan,
# maxine,
# ak,
# berghem,
# jive,
# ejiv,
# mopidy,
# radio])
[radio])
## Add a small video output to YouTube Live
#testbild = video.testsrc(pattern="smptebars")
#testbild = input.gstreamer.video(pipeline="videotestsrc pattern=snow ! video/x-raw,width=420,height=240")
#knark = mux_audio(audio=full, testbild)
#key = string.trim(file.contents("/home/per/liquidsoap-daemon/keys/youtube-key"))
#url = "rtmp://a.rtmp.youtube.com/live2/#{key}"
#enc = %ffmpeg(format="flv",
# %audio(codec="libmp3lame", samplerate=44100, q=5),
# %video(codec="libx264", width=420, height=240,
# b="800k", g=45, preset="veryfast"))
#output.url(fallible=true, url=url, enc, knark)
## Add a small video output to Facebook
#testbild = video.testsrc(pattern="smptebars")
#testbild = input.gstreamer.video(pipeline="videotestsrc pattern=snow ! video/x-raw,width=420,height=240")
#knark = mux_audio(audio=full, testbild)
#key = string.trim(file.contents("/home/per/liquidsoap-daemon/keys/facebook-key"))
#url = "rtmps://live-api-s.facebook.com:443/rtmp//#{key}"
#enc = %ffmpeg(format="flv",
# %audio(codec="aac", samplerate=44100, q=5),
# %video(codec="libx264", width=420, height=240,
# b="800k", g=45, preset="veryfast"))
#output.url(fallible=true, url=url, enc, knark)
## Add a small video output to Twitch
#testbild = video.testsrc(pattern="smptebars")
#testbild = input.gstreamer.video(pipeline="videotestsrc pattern=snow ! video/x-raw,width=420,height=240")
#knark = mux_audio(audio=full, testbild)
#key = string.trim(file.contents("/home/per/liquidsoap-daemon/keys/twitch-key"))
#url = "rtmp://a.rtmp.youtube.com/live2/#{key}"
#enc = %ffmpeg(format="flv",
# %audio(codec="libmp3lame", samplerate=44100, q=5),
# %video(codec="libx264", width=420, height=240,
# b="800k", g=45, preset="veryfast"))
#output.url(fallible=true, url=url, enc, knark)
# Temporary 2
# dull = random(weights=[1,5],[jingle, full])
# Below is a way to publish icecast streams
# on http://flows.liquidsoap.info/
# This doesn't seem to work right now,
# maybe it's deprecated but at least it
# produces no error messages. Use at own risk.
# full = register_flow(
# radio="mustafejen",
# website="https://mustafejen.se/",
# description="Stream from Ersboda",
# genre="Eclectic",
# streams=[("ogg/128k","http://mustafejen.se:8000/stream.ogg"),
# streams=[("fdkaac/64k","http://mustafejen.se:8000/feting"),
#streams=
#[("opus/32k","http://mustafejen.se:8000/stream.opus")],
# ("mp3/128k","http://mustafejen.se:8000/feting")],
# full)
# It used to be possible to scrobble on last.fm,
# maybe it still is but I have commented it out.
## full = audioscrobbler.submit.full(
## user="somebody",
## password="Nikki_Benz",
## full)
# Finally output the source named "full" described a bit
# up in this script. It will be output to icecast in various
# formats. Some outputs I don't use are commented out.
#output.icecast(%mp3(bitrate=128, stereo=true, samplerate=48000),
#host="mustafejen.se",
#port=8000,
#password="Nikki_Benz",
#mount="feting",
#description="Stream from Ersboda",
#genre="Alternative, eclectic",
#url="https://mustafejen.se/~per",
#name="mustafejen mp3",
#public=true,
#full)
# output.icecast(
# %mp3(bitrate=128, stereo=true),
# mount="listen.mp3",
# host="shaincast.caster.fm",
# port=19514,
# user="source",
# password="Nikki_Benz",
# name="somebody",
# full)
#output.icecast(%vorbis(quality=0.4 , samplerate=48000, channels=2),
#host="mustafejen.se",
#port=8443,
#password="Nikki_Benz",
#mount="stream.ogg",
#description="Stream from Ersboda",
#genre="Alternative, eclectic",
#url="https://mustafejen.se/~per",
#name="mustafejen vorbis",
#public=true,
#protocol="https",
#full)
output.icecast(%opus(vbr="unconstrained", samplerate=48000, channels=2),
host="10.0.0.6",
port=8443,
password="Nikki_Benz",
mount="stream.opus",
description="Stream from Ersboda",
genre="Alternative, eclectic",
url="https://mustafejen.se/~per",
name="mustafejen opus",
protocol="https",
public=true,
full)
#output.icecast(%fdkaac(bitrate=64, transmux="adts", channels=2, samplerate=48000, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=false),
#host="mustafejen.se",
#port=8443,
#password="Nikki_Benz",
#mount="iPhone",
#description="Stream from Ersboda",
#genre="Alternative",
#url="https://mustafejen.se/~per",
#name="mustafejen",
#public=true,
#protocol="https",
#full)
#output.icecast(%ogg(%flac(channels=2, compression=5, bits_per_sample=16)),
#host="mustafejen.se",
#port=8443,
#password="Nikki_Benz",
#mount="teststream.ogg",
#description="Stream from Ersboda",
#genre="Alternative",
#url="https://mustafejen.se/~per",
#name="mustafejen",
#public=true,
#protocol="https",
#full)
# vorbis stream to onion site
#output.external(id="Tor", fallible=true, reopen_delay=3.0, %vorbis(quality=0.4 , samplerate=48000, channels=2),
#"/usr/bin/oggfwd -n somebody -d 'X-files' localhost 9887 Nikki_Benz /mount",
#mksafe(buffer(full)))
#output.external(id="Tor", fallible=true, reopen_delay=30.0, %vorbis(quality=0.4 , samplerate=48000, channels=2),
#"/usr/bin/torsocks /usr/bin/oggfwd -n 'somebody' -d 'X-files' superdupersecret.onion 443 Nikki_Benz /mount",
#mksafe(buffer(full)))
#output.external(id="Tor", fallible=true, reopen_delay=30.0, %vorbis(quality=0.4 , samplerate=48000, channels=2),
#"/usr/bin/torsocks /usr/bin/oggfwd -n 'somebody' -d 'X-files' superdupersecret.onion 443 Nikki_Benz /mount",
#mksafe(buffer(full)))
#output.external(id="Tor", fallible=true, reopen_delay=30.0, %ogg(%opus(vbr="none", bitrate=32, samplerate=48000, channels=2)),
#"/usr/bin/torsocks /usr/bin/oggfwd -n somebody -d 'X-files' superdupersecret.onion 443 Nikki_Benz /mount",
#mksafe(buffer(full)))
# Set the size for a video frame
#set("frame.video.width",960)
#set("frame.video.height",540)
# Add some video effect
#snow = input.gstreamer.video(pipeline="videotestsrc pattern=gamut ! video/x-raw,width=960,height=540")
## Add video stream from my mobile phone
# (Haven't found the source client yet)
## Mix the video into the sound I am streaming
#bild = mux_video(video=(snow), (full))
#hild = mksafe(bild)
#output.youtube.live(audio_encoder="voaacenc", video_bitrate=2500, audio_bitrate=128000, key="secret_key", hild)
#output.youtube.live.ffmpeg(bitrate="1800", key="secret_key", url="rtmp://b.rtmp.youtube.com/live2?backup=1", hild)
### Output to srt too
#output.srt(
#host="mustafejen.se",
#port=9567,
#%gstreamer(channels=2,
# audio="lamemp3enc",
# has_video=true,
# video="x264enc",
# muxer="mpegtsmux",
# metadata="metadata",
# log=5),
#hild)
# %opus(vbr="none", bitrate=32, samplerate=48000, channels=2),
## Attempt to create a test image stream with ffmpeg
#testbild = input.external.rawvideo(id="testbild", "ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 pipe:1")
#bild = mux_video(video=(testbild), (full))
#rild = mksafe(bild)
#nuda = output.youtube.live.ffmpeg(id="twitch", url="rtmp://cph.contribute.live-video.net/app/", bitrate="2500", key="secret_key", rild)
#nuda = output.external(id="twitch", %external(video=true, process="none"), "/usr/bin/torsocks /usr/bin/ffmpeg -vcodec libx264 -b:v 5M -acodec aac -b:a 256k -f flv rtmp://cph.contribute.live-video.net/app/live_421272110_4TSO1mTvOCi0xhyCXvVaCMBzmJyQ69", rild)
#### ####
# New part of the script #
# Below is the web radio station source
# for the music community "Verket"
# In case you have come so far, it's
# similar to the stuff above, and you will
# probably be able to reverse engineer it
# by looking at documentation on the page below:
# https://www.liquidsoap.info/
# note: Verket is no longer homeless
default = single("/home/per/Musik/verket/Instängd/03-instangd-kott_ar_mord.mp3")
lista = playlist("/home/per/playlist.txt")
# Play user requests if there are any,
# otherwise one of our playlists,
# and the default file if anything goes wrong.
radio = fallback(track_sensitive=false,
[(lista),
(default)])
# Add the ability to relay live shows
#live = input.http(max_buffer=30.0, "http://mustafejen.se:8000/verketlive.ogg")
kive = audio_to_stereo(input.harbor(id="kive", replay_metadata=true, "verketlive.ogg", port=8083, password="Nikki_Benz", buffer=1.0))
#give = amplify(5.0, audio_to_stereo(input.harbor.ssl(id="give", replay_metadata=true, auth=vauth, "verketgive.ogg", port=8082, password="Nikki_Benz", buffer=1.0)))
give = amplify(5.0, audio_to_stereo(input.harbor.ssl(id="give", replay_metadata=true, password="Nikki_Benz", "verketgive.ogg", port=8082, buffer=1.0)))
trassel = fallback(track_sensitive=false, [kive, give])
verket =
fallback(track_sensitive=false,
[(trassel),
(radio)])
#verket = register_flow(
#radio="Verket",
#website="http://verketumea.se/",
#description="Bands from Verket",
#genre="Mainly Punk",
#streams=[("mp3/128k", "http://mustafejen.se:8000/verket"),
#("opus/64k", "http://mustafejen.se:8000/verket.opus")],
#verket)
# Output to FLAC file
# output.file(id="inspelning", fallible=true, %flac(channels=2, bits_per_sample=16, samplerate=48000, compression=5), "/home/per/Musik/live/verket/dump.ogg", hive)
# Output to vorbis file
# output.file(id="inspelning", fallible=true, %vorbis(quality=1.0 , samplerate=48000, channels=2), "/home/per/Musik/live/verket/dump.ogg", hive)
# Output to opus and MP3
#clock.assign_new(sync=false, [output.icecast(%mp3(bitrate=128, samplerate=48000, stereo=true),
#output.icecast(%mp3(bitrate=128, samplerate=48000, stereo=true),
#mount="verket",
#host="mustafejen.se",
#port=8000,
#user="source",
#public=true,
#genre="Mainly Punk",
#url="http://verketumea.se",
#password="Nikki_Benz",
#description="Bands from Verket",
#name="Verket mp3",
#verket)
#verket)])
#output.icecast(%fdkaac(bitrate=64, transmux="adts", channels=2, samplerate=48000, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=false),
#host="mustafejen.se",
#port=8443,
#password="Nikki_Benz",
#mount="verket",
#description="Bands from Verket",
#genre="Mainly Punk",
#url="http://verketumea.se",
#name="Verket"
#protocol="https",
#verket)
output.icecast(%opus(vbr="unconstrained", samplerate=48000, channels=2),
host="10.0.0.6",
port=8443,
password="Nikki_Benz",
mount="verket.opus",
description="Bands from Verket",
public=true,
genre="Mainly Punk",
url="https://www.facebook.com/verketumea",
name="Verket opus",
protocol="https",
verket)
#output.icecast(%ffmpeg(format="adts", %audio.copy),
#fallible=true,
#mount="/echom64.aacp",
#protocol="https",
#host="mustafejen.se",
#port=8443,
#format="audio/aacp",
#icy_metadata="true",
#password="Nikki_Benz",
#dem)
hefault = single("/home/per/Musik/diverse/Super star by Roller girl-XbIhdEAEE8M.m4a")
grejs = playlist("/home/per/Musik/grejlist.txt")
dull =
fallback(track_sensitive=false,
[(jive),
(ejiv),
(grejs),
(hefault)])
output.icecast(%opus(vbr="unconstrained", samplerate=48000, channels=2),
host="10.0.0.6",
port=8443,
password="Nikki_Benz",
mount="dull.opus",
description="Hobby stream",
genre="Alternative, eclectic",
url="https://mustafejen.se/~per",
name="dull opus",
protocol="https",
public=true,
dull)