Commit 23148b56 authored by dreamer's avatar dreamer
Browse files

first commit

parent 46f46933
version: '3'
services:
nginx-rtmp:
image: alfg/nginx-rtmp:latest
restart: unless-stopped
ports:
- 1935:1935
- 8080:8080
# - 8443:443
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
liquidsoap:
build:
context: .
dockerfile: liquidsoap.dockerfile
restart: unless-stopped
volumes:
- /mnt/radio:/mnt/radio
entrypoint:
- liquidsoap
- playlist.liq
# # LS container
FROM savonet/liquidsoap-full as liquidsoap
RUN apt-get update && apt-get install -y \
gstreamer1.0-rtsp \
gstreamer1.0-plugins-bad-videoparsers \
gstreamer1.0-libav \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \
gstreamer1.0-plugins-bad
RUN apt-get update && apt-get install -y\
frei0r-plugins \
libfrei0r-ocaml
RUN apt-get update && apt-get install -y\
ffmpeg
WORKDIR /app
COPY static/notlive.ogg /app/notlive.ogg
COPY playlist.liq .
CMD ["liquidsoap", "playlist.liq"]
daemon off;
error_log /dev/stdout info;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4000;
application streams {
live on;
#relays the incoming video to a low quality stream on this server, and to a different server
exec <%= $ffmpeg_binary %> -i rtmp://localhost/streams/$name
-c:a copy -c:v libx264 -b:v 128K -f flv rtmp://localhost/hls/$name_low
-c:a copy -vn -f flv rtmp://localhost/hls/$name_audio
-c:a copy -c:v copy -f flv rtmp://localhost/hls/$name_hi
# -c:v copy -c:a copy -f flv "rtmp://<%= $relay_server %>/show/$name";
recorder video {
record all;
record_path /mnt/radio/recordings/rtmprec/streams;
record_suffix _video.flv;
record_unique on;
}
recorder audio {
record audio;
record_path /mnt/radio/recordings/rtmprec/streams;
record_suffix _audio.flv;
record_unique on;
exec_record_done ffmpeg -i $path -metadata title="$basename" year="2019" -c:a libmp3lame /mnt/radio/recordings/rtmprec/streams/$basename.mp3;
}
# HLS on /hls
hls on;
hls_path /tmp/hls/streams ;
hls_sync 100ms;
hls_fragment_naming system;
} # end streams
# to send video to be recorded on server (not played live)
application input{
live on;
#records audio + video
recorder video {
record all;
record_path /mnt/radio/recordings/rtmprec/inputrec;
record_suffix _video.flv;
record_unique on;
}
#records audio
recorder audio {
record audio;
record_path /mnt/radio/recordings/rtmprec/inputrec;
record_suffix _audio.flv;
record_unique on;
# convert to mp3
exec_record_done ffmpeg -i $path -metadata title="$basename" year="2020" -c:a libmp3lame /mnt/radio/recordings/rtmprec/inputrec/$basename.mp3;
}
# HLS on /hls
hls on;
hls_path /tmp/hls/inputhls;
hls_sync 100ms;
hls_fragment_naming system;
}
application hls {
live on;
hls on;
hls_path /tmp/hls/variants;
hls_nested on;
hls_variant _low BANDWIDTH=160000;
hls_variant _audio BANDWIDTH=500;
hls_variant _hi BANDWIDTH=640000;
}
}
}
http {
sendfile off;
tcp_nopush on;
directio 512;
default_type application/octet-stream;
server {
listen 8080;
location /hls {
# Disable cache
add_header 'Cache-Control' 'no-cache';
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
types {
application/dash+xml mpd;
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp/hls;
}
location /variants {
# Disable cache
add_header 'Cache-Control' 'no-cache';
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
types {
application/dash+xml mpd;
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp/hls;
}
location /inputhls {
# Disable cache
add_header 'Cache-Control' 'no-cache';
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
types {
application/dash+xml mpd;
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp/hls;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /var/www/;
}
}
}
File added
#!/usr/bin/liquidsoap
# We're 48k!
set("frame.audio.samplerate",48000)
set("harbor.bind","0.0.0.0")
set("harbor.password","source")
set("harbor.password","hackme")
# Put the log file in some directory where
# you have permission to write.
set("log.file.path","/mnt/radio/logs/<script>.log")
# Print log messages to the console,
# can also be done by passing the -v option to liquidsoap.
set("log.stdout", true)
# Use the telnet server for requests
set("server.telnet.port", 9051)
set("server.telnet", true)
# Add a skip function to a source
# when it does not have one
# by default
def add_skip_command(s) =
# A command to skip
def skip(_) =
source.skip(s)
"Done!"
end
# Register the command:
server.register(namespace="#{source.id(s)}",
usage="skip",
description="Skip the current song.",
"skip",skip)
end
# Lines starting with # are comments, they are ignored.
# local sources
default = noise()
notlive = single("/app/notlive.ogg")
jingles = playlist(timeout=20.0,mode="random",reload=300,reload_mode="seconds","/mnt/radio/jingles")
papillon_archive = playlist(reload=600, "/mnt/radio/papillon_archive/")
admfest = playlist(reload=600, "/mnt/radio/Live Recordings/")
archive_mix = random(weights=[1,1,2,2],[ jingles, notlive, papillon_archive, admfest ])
# Attach a skip command to the source s:
add_skip_command(archive_mix)
# bunch of inputs
papa = strip_blank(max_blank=10.,audio_to_stereo(buffer.adaptative(mksafe(input.harbor(id="pap-a", buffer=6.0, max=60.0, port=8051, "pap-a")))))
output.dummy(fallible=true, papa)
papb = strip_blank(max_blank=60.,audio_to_stereo(buffer.adaptative(mksafe(input.harbor(id="pap-b", buffer=30.0, max=60.0, port=8051, "pap-b")))))
output.dummy(fallible=true, papb)
papc = audio_to_stereo(input.harbor(id="pap-c", port=8051, "pap-c"))
output.dummy(fallible=true, papc)
papd = audio_to_stereo(strip_blank(max_blank=115.,input.harbor(id="pap-d", port=8051, "pap-d")))
output.dummy(fallible=true, papd)
pape = audio_to_stereo(strip_blank(max_blank=115.,input.harbor(id="pap-e", port=8051, "pap-e")))
output.dummy(fallible=true, pape)
full = fallback(track_sensitive = false, [papa, papb, papc, papd, pape, normalize(smart_crossfade(archive_mix)), default ])
### stream outputs
icecast_ogg = output.icecast(
vorbis_encoding,
connection_timeout=1.0,
fallible=true,
url="https://adm.amsterdam/radio",
genre="papillon archive / not live",
name="papillon",
description="lalalal"
)
icecast_mp3 = output.icecast(
mp3_encoding,
connection_timeout=1.0,
fallible=true,
url="https://adm.amsterdam/radio",
genre="papillon archive / not live mp3 stream",
name="papillon",
description="lalalal"
)
icecast_opus = output.icecast(
%ogg(%opus),
connection_timeout=1.0,
fallible=true,
url="https://adm.amsterdam/radio",
genre="papillon archive / not live opus stream",
name="papillon",
description="lalalal"
)
icecast_ogg(full, mount="pap-ls1.ogg", host="deathstar.puscii.nl", port=8000, password="icecold")
icecast_mp3(full, mount="pap-ls1.mp3", host="deathstar.puscii.nl", port=8000, password="icecold")
icecast_opus(full,mount="pap-ls1.opus", host="deathstar.puscii.nl", port=8000, password="icecold")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment