2021-02-28 17:04:41 +00:00
set("log.stdout", true)
set("log.file", false)
set("log.level", 4)
set("server.telnet", true)
set("server.telnet.bind_addr", "127.0.0.1")
set("server.telnet.port", 21337)
set("init.allow_root",true)
set("frame.video.width", 1920)
set("frame.video.height", 1080)
2022-03-08 07:56:59 +00:00
set("audio.converter.samplerate.libsamplerate.quality", "best")
set("audio.converter.samplerate.native.quality","linear")
set("sandbox", "disabled")
2021-02-28 17:04:41 +00:00
%include "settings.liq"
%include "metadata_api.liq"
2022-03-08 07:56:59 +00:00
%include "stream_api.liq"
2021-02-28 17:04:41 +00:00
%include "silent_fallback.liq"
2022-03-08 07:56:59 +00:00
s = input.http(id="input_ice_main", max_buffer=4., "http://127.0.0.1:61120/main")
2021-02-28 17:04:41 +00:00
# Split audio off to be handled specially
2023-03-17 03:41:51 +00:00
# NOTE - drop_video causes a weird error during script validation, we assume audio-only here
# a = drop_video(s)
a = s
2022-03-13 05:53:21 +00:00
a = mksafe_soft(a)
2021-03-07 21:21:01 +00:00
output.dummy(a)
2022-03-08 07:56:59 +00:00
2023-03-17 03:41:51 +00:00
def append_encoder_meta(_) =
new_meta = [
2022-03-13 06:26:05 +00:00
("encoder", "Liquidsoap #{liquidsoap.version}"),
]
2023-03-17 03:41:51 +00:00
new_meta = if null.defined(stream_name) then
[...new_meta, ("stream_name", null.get(stream_name))]
else
new_meta
end
new_meta = if null.defined(stream_description) then
[...new_meta, ("stream_description", null.get(stream_description))]
else
new_meta
end
new_meta
2022-03-13 05:53:21 +00:00
end
2023-03-17 03:41:51 +00:00
a = metadata.map(id="main", append_encoder_meta, a)
2022-03-13 06:26:05 +00:00
a = setup_harbor_metadata_api(a)
2022-03-08 07:56:59 +00:00
2022-09-11 12:31:42 +00:00
# Output to internal Icecast server.
# @argsof output.icecast[!fallible,!port,!host,!user,!password,!name,!description]
# @param e Encoding format
# @param s The source to output
def internal_icecast(
# NOTE - We have to have !headers here, otherwise liquidsoap will complain "this value has type _ * _ but it should be a supertype of the type of the value at…"
%argsof(
output.icecast[!fallible,!headers,!port,!host,!user,!password,!name,!description]
),
e, s) =
output.icecast(
%argsof(
output.icecast[!fallible,!headers,!port,!host,!user,!password,!name,!description]
),
fallible=true,
headers=[],
port=61120,
host="127.0.0.1",
2023-03-17 03:41:51 +00:00
user=null.get(internal_icecast_username),
password=null.get(internal_icecast_password),
name=null.get(stream_name),
description=null.get(stream_description),
2022-09-11 12:31:42 +00:00
e, s)
end
2022-03-08 07:56:59 +00:00
setup_harbor_stream_api(internal_icecast(
2022-03-13 05:53:21 +00:00
id="out_a_int_vorbis",
# %ogg(%flac),
mount="/outa/vorbis",
start=false,
%ffmpeg(
format="ogg",
%audio(
codec="libvorbis",
flags=2, # CODEC_FLAG_QSCALE (enables VBR mode based on qscale aka global_quality)
global_quality=1180., # gets divided by FF_QP2LAMBDA=118
),
),
a,
))
setup_harbor_stream_api(internal_icecast(
id="out_a_int_flac",
2021-03-07 21:21:01 +00:00
mount="/outa/flac",
2022-03-13 05:53:21 +00:00
start=true,
%ffmpeg(
format="ogg",
%audio(
codec="flac",
),
),
a,
))
setup_harbor_stream_api(internal_icecast(
id="out_a_int_mp3_96",
mount="/outa/mp3_96",
start=false,
format="audio/mpeg",
2022-09-26 20:06:20 +00:00
encoding="ISO-8859-1",
2022-03-13 05:53:21 +00:00
%ffmpeg(
format="mp3",
%audio(
codec="libmp3lame",
b=96000,
compression_level=0,
),
),
a,
))
setup_harbor_stream_api(internal_icecast(
id="out_a_int_mp3_128",
mount="/outa/mp3_128",
start=false,
format="audio/mpeg",
2022-09-26 20:06:20 +00:00
encoding="ISO-8859-1",
2022-03-13 05:53:21 +00:00
%ffmpeg(
format="mp3",
%audio(
codec="libmp3lame",
b=128000,
compression_level=0,
),
),
a,
))
2022-03-08 07:56:59 +00:00
# REKT.fm
2023-03-17 03:41:51 +00:00
if null.defined(rektfm_username) and null.defined(rektfm_password) then
2022-03-09 08:42:59 +00:00
setup_harbor_stream_api(output.icecast(
id="out_a_rekt",
2022-03-13 05:53:21 +00:00
# %ogg(%flac),
# %mp3(bitrate=320),
2022-03-09 08:42:59 +00:00
fallible=true,
mount="rekt",
2022-03-09 12:26:10 +00:00
port=60000,
2022-03-13 05:53:21 +00:00
host="stream.rekt.network",
# host="stream.rekt.fm",
2023-03-17 03:41:51 +00:00
user=null.get(rektfm_username),
name=null.get(stream_name),
description=null.get(stream_description),
password=null.get(rektfm_password),
2022-03-09 08:42:59 +00:00
start=false,
2022-03-13 05:53:21 +00:00
%ffmpeg(
format="ogg",
%audio(
codec="libvorbis",
flags=2, # CODEC_FLAG_QSCALE (enables VBR mode based on qscale aka global_quality)
global_quality=1180., # gets divided by FF_QP2LAMBDA=118
),
),
a,
# %ffmpeg(format="ogg", %audio.copy),
# a_vorbis,
))
2022-03-09 08:42:59 +00:00
end