-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path22x.liq
53 lines (42 loc) · 1.29 KB
/
22x.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
### Liquidsoap 2.2.x Syntax ###
#canvas & fps settings
settings.frame.video.width := 1280
settings.frame.video.height := 720
settings.frame.video.framerate := 30
#metadata functions
song_author = ref('')
def apply_artist(m) =
song_author := m["artist"]
end
song_title = ref('')
def apply_title(m) =
song_title := m["title"]
end
def get_track_name_text()
"$(artist) - $(title) " % [
("artist", song_author()),
("title", song_title())
]
end
#audio source
audio = playlist(reload_mode="watch", "/home/YOUR_NICKNAME/radio/music")
audio = mksafe(audio)
#video source
background = single("/home/YOUR_NICKNAME/radio/background.gif")
#calling metadata
audio.on_track(apply_artist)
audio.on_track(apply_title)
#drawtext
background = video.add_text(color=0xFFFFFF, font="/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", speed=0, x=50, y=50, size=26,
get_track_name_text,
background)
#mixing sources
radio = source.mux.video(video=background, audio)
#rtmp & codec
url = "rtmp://localhost/live"
enc = %ffmpeg(format="flv",
%video(codec="libx264", width=1280, height=720, pixel_format="yuv420p",
b="1500k", maxrate="1500k", minrate="1500k", bufsize="3000k", profile="Main", preset="veryfast", framerate=30, g=60),
%audio(codec="aac", samplerate=44100, b="128k"))
#output
output.url(fallible=true, url=url, enc, radio)