Created
March 9, 2018 21:19
-
-
Save jonty-comp/6e64e5488723d5658696f661d382e3dc to your computer and use it in GitHub Desktop.
Streaming to icecast and disk with Liquidsoap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/liquidsoap | |
# Icecast stream parameters | |
stream_host = "icecast.server.com" | |
stream_port = 80 | |
stream_password = "hackme" | |
# Set up logging | |
set("log.level", 3) | |
set("log.stdout", true) | |
# Input from a single ALSA source | |
audio = input.alsa(device = "hw:0") | |
# Stream to Icecast | |
output.icecast( | |
%mp3(bitrate=256), | |
host = stream_host, | |
port = stream_port, | |
password = stream_password, | |
mount = "live.mp3", | |
name = "Live stream", | |
description = "Live stream", | |
genre = "Misc", | |
url = "http://localhost/", | |
audio | |
) | |
output.icecast( | |
%ogg(%flac), | |
host = stream_host, | |
port = stream_port, | |
password = stream_password, | |
mount = "live.flac", | |
name = "Live stream", | |
description = "Live stream", | |
genre = "Misc", | |
url = "http://localhost/", | |
audio | |
) | |
output.icecast( | |
%opus( | |
vbr = "constrained", | |
applicaton = "audio", | |
complexity = 8, | |
max_bandwidth = "wide_band", | |
samplerate = 48000, | |
frame_size = 5., | |
bitrate = "auto", | |
signal = "music", | |
channels = 2 | |
), | |
host = stream_host, | |
port = stream_port, | |
password = stream_password, | |
mount = "live.opus", | |
name = "Live stream", | |
description = "Live stream", | |
genre = "Misc", | |
url = "http://localhost/", | |
audio | |
) | |
# Save to segmented files every 15m | |
output.file( | |
%flac(samplerate=48000), | |
"/tmp/%Y-%m-%d/%Y-%m-%d-%H_%M_%S.flac", | |
reopen_when = {0m or 15m or 30m or 45m}, | |
audio | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment