-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.liq
57 lines (45 loc) · 1.31 KB
/
script.liq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
settings.log.stdout := true
settings.log.level := 3
# Harbor HTTP server settings
settings.harbor.bind_addrs := ["0.0.0.0"]
# Audio settings
settings.frame.audio.channels := 2
settings.frame.audio.samplerate := 44100
settings.audio.converter.samplerate.libsamplerate.quality := "fast"
# Define Input
safe_blank = blank(id="safe_blank")
live = input.harbor("live", port=8000, user="source", password="hackme")
source = fallback(id="fallback_prod", track_sensitive=false, [live, safe_blank])
# Define Output
aac_lofi =
%ffmpeg(format = "mpegts", %audio(codec = "aac", channels = 2, ar = 44100))
aac_midfi =
%ffmpeg(
format = "mpegts",
%audio(codec = "aac", channels = 2, ar = 44100, b = "96k")
)
aac_hifi =
%ffmpeg(
format = "mpegts",
%audio(codec = "aac", channels = 2, ar = 44100, b = "192k")
)
streams =
[("aac_lofi", aac_lofi), ("aac_midfi", aac_midfi), ("aac_hifi", aac_hifi)]
def segment_name(~position, ~extname, stream_name) =
timestamp = int_of_float(time())
duration = 2
"#{stream_name}_#{duration}_#{timestamp}_#{position}.#{extname}"
end
output.file.hls(
playlist="live.m3u8",
segment_duration=2.0,
segments=5,
segments_overhead=5,
segment_name=segment_name,
perm=422,
dir_perm=0o755,
persist_at="/usr/share/liquidsoap/state.config",
"/tmp/hls",
streams,
source
)