From 67ad27bf0fcb14523c69af4d37534eaee5f87d63 Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Sun, 22 Mar 2020 14:56:47 +0900 Subject: [PATCH 1/7] WIP input hls stream --- liquidsoap/Dockerfile | 22 +++++++++++++++++++--- liquidsoap/PACKAGES | 2 +- liquidsoap/radio.liq | 12 +++++++----- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/liquidsoap/Dockerfile b/liquidsoap/Dockerfile index fc83826..a0b36a0 100644 --- a/liquidsoap/Dockerfile +++ b/liquidsoap/Dockerfile @@ -48,8 +48,24 @@ RUN opam update -y RUN opam install depext -y RUN eval `opam config env` -RUN sudo opam depext taglib mad lame ogg vorbis cry samplerate liquidsoap -y -RUN opam install taglib mad lame ogg vorbis cry samplerate liquidsoap -y +RUN sudo opam depext taglib mad lame ogg vorbis cry samplerate ffmpeg liquidsoap -y +RUN opam install taglib mad lame ogg vorbis cry samplerate ffmpeg liquidsoap -y + +#RUN ["/bin/bash", "-c", "ls -lha ~"] +RUN cd /home/liquidsoap; git clone https://github.com/savonet/liquidsoap-full +ADD PACKAGES /home/liquidsoap/liquidsoap-full/PACKAGES +RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/; git rev-parse HEAD;"] +RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/; make init && make update;"] +RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/liquidsoap; git rev-parse HEAD;"] +#RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/ocaml-mm; git rev-parse HEAD;"] +#RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/ocaml-mm; eval `opam config env`; opam pin add . -y;"] +#ADD protocols.liq /home/liquidsoap/liquidsoap-full/liquidsoap/libs/protocols.liq +#RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/liquidsoap; eval `opam config env`; opam pin add . -y;"] +RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; ./bootstrap;"] +#RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; ls -lha; cat configure"] +RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; ./configure;"] +RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; make;"] +RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; sudo make install"] RUN mkdir /home/liquidsoap/radio ADD ./ /home/liquidsoap/radio/ @@ -63,4 +79,4 @@ RUN chown 1000:1000 /home/liquidsoap/tracks RUN chown 1000:1000 /home/liquidsoap/recordings EXPOSE 9000 -CMD ["/bin/bash", "-c", "eval `opam config env`; liquidsoap radio.liq"] +CMD ["/bin/bash", "-c", "eval `opam config env`; /usr/local/bin/liquidsoap radio.liq"] diff --git a/liquidsoap/PACKAGES b/liquidsoap/PACKAGES index be4b45c..e4bb7dd 100644 --- a/liquidsoap/PACKAGES +++ b/liquidsoap/PACKAGES @@ -121,7 +121,7 @@ ocaml-flac # FFMPEG is currently only used to convert from # and to many formats. -# ocaml-ffmpeg +ocaml-ffmpeg # Frei0r is a minimalistic plugin API for video sources and filters. # ocaml-frei0r diff --git a/liquidsoap/radio.liq b/liquidsoap/radio.liq index 1c2e2c6..814bad1 100755 --- a/liquidsoap/radio.liq +++ b/liquidsoap/radio.liq @@ -1,15 +1,15 @@ #!/usr/local/bin/liquidsoap %include "tunein.liq" -set("sandbox.tool","disabled") +#set("sandbox.tool","disabled") set("log.file",true) set("log.file.path","/var/log/liquidsoap.log") set("log.stdout",true) set("log.level",4) -set("server.telnet",true) -set("server.socket",true) -set("server.socket.path","/home/liquidsoap/tracks/liquidsoap.sock") +#set("server.telnet",true) +#set("server.socket",true) +#set("server.socket.path","/home/liquidsoap/tracks/liquidsoap.sock") set("harbor.bind_addrs",["0.0.0.0"]) @@ -215,12 +215,14 @@ def pub_metadata(m) = # log("desc: #{desc}"); end +rtmp_source = audio_to_stereo(drop_video(input.hls("https://vj.datafruits.fm/hls/datafruits.m3u8"))) + live_dj := map_metadata(new_meta, !live_dj,update=false) live_dj := pipe(process='./stereo_tool_cmd_64 - - -s ./stereotool.sts', buffer=10.0, !live_dj) source = fallback(id="fallback",track_sensitive=false, - [!live_dj,mksafe(backup_playlist)]) + [rtmp_source, !live_dj,mksafe(backup_playlist)]) source = if tunein_metadata_updates_enabled == "true" then on_track(tunein.submit(partnerid=tunein_partner_id,partnerkey=tunein_partner_key,stationid=tunein_station_id), source) else source end From 8afe500d38454c6caf37bf8baec8761f8062646f Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Fri, 27 Mar 2020 23:49:40 +0900 Subject: [PATCH 2/7] try gstreamer and gavl --- liquidsoap/Dockerfile | 4 ++-- liquidsoap/PACKAGES | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/liquidsoap/Dockerfile b/liquidsoap/Dockerfile index a0b36a0..61fea5a 100644 --- a/liquidsoap/Dockerfile +++ b/liquidsoap/Dockerfile @@ -48,8 +48,8 @@ RUN opam update -y RUN opam install depext -y RUN eval `opam config env` -RUN sudo opam depext taglib mad lame ogg vorbis cry samplerate ffmpeg liquidsoap -y -RUN opam install taglib mad lame ogg vorbis cry samplerate ffmpeg liquidsoap -y +RUN sudo opam depext taglib mad lame ogg vorbis cry samplerate ffmpeg gavl gstreamer liquidsoap -y +RUN opam install taglib mad lame ogg vorbis cry samplerate ffmpeg gavl gstreamer liquidsoap -y #RUN ["/bin/bash", "-c", "ls -lha ~"] RUN cd /home/liquidsoap; git clone https://github.com/savonet/liquidsoap-full diff --git a/liquidsoap/PACKAGES b/liquidsoap/PACKAGES index e4bb7dd..8af17bc 100644 --- a/liquidsoap/PACKAGES +++ b/liquidsoap/PACKAGES @@ -38,7 +38,7 @@ ocaml-cry # Gstreamer is a library for constructing graphs of media-handling components. # It is currently used to provide audio and video encoding and decoding # as well as input and outputs such as V4l inputs. -# ocaml-gstreamer +ocaml-gstreamer # ============================================================================ # Codecs @@ -117,7 +117,7 @@ ocaml-flac # is very efficient and has a quality setting for # tweaking load vs. quality of the conversion. # It is the recommended module to use with video -# ocaml-gavl +ocaml-gavl # FFMPEG is currently only used to convert from # and to many formats. From d0f6efeced58aa3110181bb218fd43bf947a07ce Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Thu, 23 Apr 2020 10:33:37 -0700 Subject: [PATCH 3/7] use new rtmp stream --- liquidsoap/radio.liq | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/liquidsoap/radio.liq b/liquidsoap/radio.liq index 814bad1..bd2fb30 100755 --- a/liquidsoap/radio.liq +++ b/liquidsoap/radio.liq @@ -7,9 +7,9 @@ set("log.file.path","/var/log/liquidsoap.log") set("log.stdout",true) set("log.level",4) -#set("server.telnet",true) -#set("server.socket",true) -#set("server.socket.path","/home/liquidsoap/tracks/liquidsoap.sock") +set("server.telnet",true) +set("server.socket",true) +set("server.socket.path","/home/liquidsoap/tracks/liquidsoap.sock") set("harbor.bind_addrs",["0.0.0.0"]) @@ -47,6 +47,9 @@ def icy_update(v) = "Done !" end +def clear_queue() = +end + server.register("update",namespace="metadata", description="Update metadata", usage="update title=foo,album=bar,..", @@ -215,14 +218,14 @@ def pub_metadata(m) = # log("desc: #{desc}"); end -rtmp_source = audio_to_stereo(drop_video(input.hls("https://vj.datafruits.fm/hls/datafruits.m3u8"))) +hls_source = audio_to_stereo(drop_video((input.hls("https://vj.bluelighttapes.com/hls/datafruits.m3u8"):source(2,1,0)))) live_dj := map_metadata(new_meta, !live_dj,update=false) live_dj := pipe(process='./stereo_tool_cmd_64 - - -s ./stereotool.sts', buffer=10.0, !live_dj) source = fallback(id="fallback",track_sensitive=false, - [rtmp_source, !live_dj,mksafe(backup_playlist)]) + [hls_source, !live_dj,mksafe(backup_playlist)]) source = if tunein_metadata_updates_enabled == "true" then on_track(tunein.submit(partnerid=tunein_partner_id,partnerkey=tunein_partner_key,stationid=tunein_station_id), source) else source end From ad4e4fee8d7372b7d77b04a5b9d5403c6df4e454 Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Thu, 17 Sep 2020 14:06:58 -0700 Subject: [PATCH 4/7] use input.external.ffmpeg --- liquidsoap/Dockerfile | 27 ++++++++++++++------------- liquidsoap/radio.liq | 31 ++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/liquidsoap/Dockerfile b/liquidsoap/Dockerfile index 61fea5a..152bc66 100644 --- a/liquidsoap/Dockerfile +++ b/liquidsoap/Dockerfile @@ -15,7 +15,7 @@ RUN apt-get update && apt-get upgrade -y # for liquidsoap RUN apt-get install -y --allow-unauthenticated build-essential autoconf curl git ocaml ocaml-native-compilers camlp4-extra opam \ - libmad0-dev libtag1-dev libmp3lame-dev libogg-dev libvorbis-dev libfaac-dev libfaad-dev libfdk-aac-dev libflac-dev \ + libmad0-dev libtag1-dev libmp3lame-dev libogg-dev libvorbis-dev libfaac-dev libfaad-dev libfdk-aac-dev libflac-dev ffmpeg \ libmagic-dev \ pkg-config \ wget telnet \ @@ -43,29 +43,30 @@ RUN apt-get install -y gdb USER liquidsoap RUN opam init -y --disable-sandboxing --solver=mccs -RUN opam switch create new 4.09.0 +RUN opam switch create new 4.08.0 RUN opam update -y RUN opam install depext -y RUN eval `opam config env` RUN sudo opam depext taglib mad lame ogg vorbis cry samplerate ffmpeg gavl gstreamer liquidsoap -y RUN opam install taglib mad lame ogg vorbis cry samplerate ffmpeg gavl gstreamer liquidsoap -y +RUN eval `opam config env` && liquidsoap --version #RUN ["/bin/bash", "-c", "ls -lha ~"] -RUN cd /home/liquidsoap; git clone https://github.com/savonet/liquidsoap-full -ADD PACKAGES /home/liquidsoap/liquidsoap-full/PACKAGES -RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/; git rev-parse HEAD;"] -RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/; make init && make update;"] -RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/liquidsoap; git rev-parse HEAD;"] +# RUN cd /home/liquidsoap; git clone https://github.com/savonet/liquidsoap-full +# ADD PACKAGES /home/liquidsoap/liquidsoap-full/PACKAGES +# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/; git rev-parse HEAD;"] +# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/; make init && make update;"] +# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/liquidsoap; git rev-parse HEAD;"] #RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/ocaml-mm; git rev-parse HEAD;"] #RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/ocaml-mm; eval `opam config env`; opam pin add . -y;"] #ADD protocols.liq /home/liquidsoap/liquidsoap-full/liquidsoap/libs/protocols.liq #RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/liquidsoap; eval `opam config env`; opam pin add . -y;"] -RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; ./bootstrap;"] -#RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; ls -lha; cat configure"] -RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; ./configure;"] -RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; make;"] -RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; sudo make install"] +# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; ./bootstrap;"] +# #RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; ls -lha; cat configure"] +# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; ./configure;"] +# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; make;"] +# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; sudo make install"] RUN mkdir /home/liquidsoap/radio ADD ./ /home/liquidsoap/radio/ @@ -79,4 +80,4 @@ RUN chown 1000:1000 /home/liquidsoap/tracks RUN chown 1000:1000 /home/liquidsoap/recordings EXPOSE 9000 -CMD ["/bin/bash", "-c", "eval `opam config env`; /usr/local/bin/liquidsoap radio.liq"] +CMD ["/bin/bash", "-c", "eval `opam config env` && liquidsoap radio.liq"] diff --git a/liquidsoap/radio.liq b/liquidsoap/radio.liq index bd2fb30..c7a40ce 100755 --- a/liquidsoap/radio.liq +++ b/liquidsoap/radio.liq @@ -5,11 +5,11 @@ set("log.file",true) set("log.file.path","/var/log/liquidsoap.log") set("log.stdout",true) -set("log.level",4) +set("log.level",5) -set("server.telnet",true) -set("server.socket",true) -set("server.socket.path","/home/liquidsoap/tracks/liquidsoap.sock") +#set("server.telnet",true) +#set("server.socket",true) +#set("server.socket.path","/home/liquidsoap/tracks/liquidsoap.sock") set("harbor.bind_addrs",["0.0.0.0"]) @@ -25,7 +25,7 @@ tunein_station_id = getenv("TUNEIN_STATION_ID") tunein_metadata_updates_enabled = getenv("TUNEIN_METADATA_UPDATES_ENABLED") # liq_secret = getenv("LIQ_SECRET") - +# def icy_update(v) = # Parse the argument l = string.split(separator=",",v) @@ -47,8 +47,8 @@ def icy_update(v) = "Done !" end -def clear_queue() = -end +# def clear_queue() = +# end server.register("update",namespace="metadata", description="Update metadata", @@ -68,6 +68,7 @@ current_dump_filename = ref "" stop_dump_f = ref (fun () -> ()) live_dj = ref empty() +live_video_audio = ref empty() def get_user(user,password) = if user == "source" then @@ -218,14 +219,24 @@ def pub_metadata(m) = # log("desc: #{desc}"); end -hls_source = audio_to_stereo(drop_video((input.hls("https://vj.bluelighttapes.com/hls/datafruits.m3u8"):source(2,1,0)))) +live_video_audio := audio_to_stereo(drop_video((input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=60.0, max=120.0, "-i http://streampusher.com:1024/dash/datafruits.mpd")))) +#live_video_audio := audio_to_stereo(drop_video((input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=30.0, max=60.0, "-i http://rtmp:1024/hls/datafruits.m3u8")))) +#live_video_audio := audio_to_stereo(drop_video((input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=30.0, max=60.0, "-i http://rtmp:1024/dash/datafruits.mpd")))) +#live_video_audio := audio_to_stereo(drop_video((input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=30.0, max=60.0, "-i https://vj.bluelighttapes.com/hls/datafruits.m3u8")))) + +#live_video = audio_to_stereo(drop_audio(input.external.ffmpeg("https://vj.bluelighttapes.com/hls/datafruits.m3u8"))) + +#vj_video_only = drop_audio((input.external.ffmpeg("https://vj.bluelighttapes.com/hls/datafruits.m3u8"):source(2,1,0))) live_dj := map_metadata(new_meta, !live_dj,update=false) live_dj := pipe(process='./stereo_tool_cmd_64 - - -s ./stereotool.sts', buffer=10.0, !live_dj) +live_video_audio := pipe(process='./stereo_tool_cmd_64 - - -s ./stereotool.sts', buffer=10.0, !live_video_audio) source = fallback(id="fallback",track_sensitive=false, - [hls_source, !live_dj,mksafe(backup_playlist)]) + [!live_video_audio, !live_dj, mksafe(backup_playlist)]) + +#video_source = fallback([live_video, vj_video]) source = if tunein_metadata_updates_enabled == "true" then on_track(tunein.submit(partnerid=tunein_partner_id,partnerkey=tunein_partner_key,stationid=tunein_station_id), source) else source end @@ -245,3 +256,5 @@ clock.assign_new(id="mp3_icecast", [output.icecast(%mp3,id="icecast", icy_metadata="true",description="", url="", encoding="UTF-8", mksafe(buffer(source)))]) + +# output.external.ffmpeg From a9f23b1495df771aac7d0a56770bcf6244ddd151 Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Fri, 5 Feb 2021 23:57:02 +0900 Subject: [PATCH 5/7] use arch linux --- liquidsoap/Dockerfile | 83 +++++++++++-------------------------------- 1 file changed, 21 insertions(+), 62 deletions(-) diff --git a/liquidsoap/Dockerfile b/liquidsoap/Dockerfile index 152bc66..81805f2 100644 --- a/liquidsoap/Dockerfile +++ b/liquidsoap/Dockerfile @@ -1,72 +1,31 @@ -FROM ubuntu:latest +FROM archlinux -RUN rm -rf /etc/apt/sources.list -RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt bionic main restricted universe multiverse" >> /etc/apt/sources.list -RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-updates main restricted universe multiverse" >> /etc/apt/sources.list -RUN echo "deb-src mirror://mirrors.ubuntu.com/mirrors.txt bionic-updates main restricted universe multiverse" >> /etc/apt/sources.list -RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-backports main restricted universe multiverse" >> /etc/apt/sources.list -RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-security main restricted universe multiverse" >> /etc/apt/sources.list +RUN yes | pacman -Sy opam make m4 gcc patch diffutils ffmpeg git automake autoconf pkg-config which taglib -RUN apt-get clean -RUN apt-get update && apt-get upgrade -y -RUN apt-get install -y software-properties-common -RUN add-apt-repository ppa:avsm/ppa -RUN apt-get update && apt-get upgrade -y +RUN useradd liquidsoap && mkdir /home/liquidsoap && chown -R liquidsoap /home/liquidsoap -# for liquidsoap -RUN apt-get install -y --allow-unauthenticated build-essential autoconf curl git ocaml ocaml-native-compilers camlp4-extra opam \ - libmad0-dev libtag1-dev libmp3lame-dev libogg-dev libvorbis-dev libfaac-dev libfaad-dev libfdk-aac-dev libflac-dev ffmpeg \ - libmagic-dev \ - pkg-config \ - wget telnet \ - mccs sudo -# for ruby -RUN apt-get install -y --force-yes libssl-dev libreadline-dev - -# jq -RUN apt-get install -y --force-yes jq - -RUN apt-get clean - -# add liquidsoap user -RUN useradd --create-home -s /bin/bash liquidsoap ;\ - adduser liquidsoap sudo -RUN echo "Defaults !requiretty" >> /etc/sudoers -RUN echo "%sudo ALL=NOPASSWD: ALL" >> /etc/sudoers -RUN echo 'eval "$(opam config env)"' >> /home/liquidsoap/.bashrc - -RUN touch /var/log/liquidsoap.log -RUN chown liquidsoap:users /var/log/liquidsoap.log - -RUN apt-get install -y libpcre3-dev -RUN apt-get install -y gdb +ENV HOME=/home/liquidsoap USER liquidsoap -RUN opam init -y --disable-sandboxing --solver=mccs -RUN opam switch create new 4.08.0 -RUN opam update -y -RUN opam install depext -y -RUN eval `opam config env` -RUN sudo opam depext taglib mad lame ogg vorbis cry samplerate ffmpeg gavl gstreamer liquidsoap -y -RUN opam install taglib mad lame ogg vorbis cry samplerate ffmpeg gavl gstreamer liquidsoap -y -RUN eval `opam config env` && liquidsoap --version +RUN opam init --disable-sandboxing --yes -#RUN ["/bin/bash", "-c", "ls -lha ~"] -# RUN cd /home/liquidsoap; git clone https://github.com/savonet/liquidsoap-full -# ADD PACKAGES /home/liquidsoap/liquidsoap-full/PACKAGES -# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/; git rev-parse HEAD;"] -# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/; make init && make update;"] -# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/liquidsoap; git rev-parse HEAD;"] -#RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/ocaml-mm; git rev-parse HEAD;"] -#RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/ocaml-mm; eval `opam config env`; opam pin add . -y;"] -#ADD protocols.liq /home/liquidsoap/liquidsoap-full/liquidsoap/libs/protocols.liq -#RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full/liquidsoap; eval `opam config env`; opam pin add . -y;"] -# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; ./bootstrap;"] -# #RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; ls -lha; cat configure"] -# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; ./configure;"] -# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; make;"] -# RUN ["/bin/bash", "-c", "cd /home/liquidsoap/liquidsoap-full; eval `opam config env`; sudo make install"] +WORKDIR /home/liquidsoap + +# add liquidsoap user +#RUN useradd --create-home -s /bin/bash liquidsoap +# usermod -a -G sudo liquidsoap +# RUN echo "Defaults !requiretty" >> /etc/sudoers +# RUN echo "%sudo ALL=NOPASSWD: ALL" >> /etc/sudoers +#RUN echo 'eval "$(opam config env)"' >> /home/liquidsoap/.bashrc + +#RUN touch /var/log/liquidsoap.log +#RUN chown liquidsoap:users /var/log/liquidsoap.log + +RUN for i in ocaml-ffmpeg ocaml-dtools ocaml-duppy ocaml-mm ocaml-cry ocaml-taglib liquidsoap; do \ + cd /home/liquidsoap && git clone https://github.com/savonet/$i && cd $i && opam pin add --yes --no-action .; \ + done +RUN opam install --yes liquidsoap ffmpeg cry taglib RUN mkdir /home/liquidsoap/radio ADD ./ /home/liquidsoap/radio/ From 5f6a4ae07cf1b24b290e0e0b4a0f409d817d0fb8 Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Tue, 9 Feb 2021 12:05:23 +0900 Subject: [PATCH 6/7] fix dockerfile --- liquidsoap/Dockerfile | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/liquidsoap/Dockerfile b/liquidsoap/Dockerfile index 81805f2..a85b73f 100644 --- a/liquidsoap/Dockerfile +++ b/liquidsoap/Dockerfile @@ -1,8 +1,11 @@ FROM archlinux -RUN yes | pacman -Sy opam make m4 gcc patch diffutils ffmpeg git automake autoconf pkg-config which taglib +RUN yes | pacman -Sy opam make m4 gcc patch diffutils ffmpeg git automake autoconf pkg-config which taglib sudo glibc jq RUN useradd liquidsoap && mkdir /home/liquidsoap && chown -R liquidsoap /home/liquidsoap +RUN usermod -aG wheel liquidsoap +RUN echo "Defaults !requiretty" >> /etc/sudoers +RUN echo "%wheel ALL=NOPASSWD: ALL" >> /etc/sudoers ENV HOME=/home/liquidsoap @@ -19,13 +22,17 @@ WORKDIR /home/liquidsoap # RUN echo "%sudo ALL=NOPASSWD: ALL" >> /etc/sudoers #RUN echo 'eval "$(opam config env)"' >> /home/liquidsoap/.bashrc -#RUN touch /var/log/liquidsoap.log -#RUN chown liquidsoap:users /var/log/liquidsoap.log - -RUN for i in ocaml-ffmpeg ocaml-dtools ocaml-duppy ocaml-mm ocaml-cry ocaml-taglib liquidsoap; do \ - cd /home/liquidsoap && git clone https://github.com/savonet/$i && cd $i && opam pin add --yes --no-action .; \ - done -RUN opam install --yes liquidsoap ffmpeg cry taglib +RUN sudo touch /var/log/liquidsoap.log +RUN sudo chown liquidsoap:users /var/log/liquidsoap.log + +RUN opam install depext -y +RUN opam depext taglib mad lame ogg vorbis cry samplerate liquidsoap -y +RUN opam install taglib mad lame ogg vorbis cry samplerate liquidsoap -y +# RUN for i in ocaml-ffmpeg ocaml-dtools ocaml-duppy ocaml-mm ocaml-cry ocaml-taglib ocaml-lame ocaml-ogg ocaml-vorbis ocaml-samplerate liquidsoap; do \ +# cd /home/liquidsoap && git clone https://github.com/savonet/$i && cd $i && opam pin add --yes --no-action .; \ +# done +# RUN opam install --yes liquidsoap ffmpeg cry taglib lame ogg vorbis samplerate +RUN eval `opam config env`;liquidsoap --version RUN mkdir /home/liquidsoap/radio ADD ./ /home/liquidsoap/radio/ From 24c868d0fcc66a5eb97c08e01c2f17d09bc75c1f Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Sat, 20 Feb 2021 10:02:36 +0900 Subject: [PATCH 7/7] video fallback --- liquidsoap/Dockerfile | 7 +++++-- liquidsoap/radio.liq | 38 ++++++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/liquidsoap/Dockerfile b/liquidsoap/Dockerfile index a85b73f..5e75361 100644 --- a/liquidsoap/Dockerfile +++ b/liquidsoap/Dockerfile @@ -26,8 +26,8 @@ RUN sudo touch /var/log/liquidsoap.log RUN sudo chown liquidsoap:users /var/log/liquidsoap.log RUN opam install depext -y -RUN opam depext taglib mad lame ogg vorbis cry samplerate liquidsoap -y -RUN opam install taglib mad lame ogg vorbis cry samplerate liquidsoap -y +RUN opam depext gavl ffmpeg taglib mad lame ogg vorbis cry samplerate liquidsoap -y +RUN opam install gavl ffmpeg taglib mad lame ogg vorbis cry samplerate liquidsoap -y # RUN for i in ocaml-ffmpeg ocaml-dtools ocaml-duppy ocaml-mm ocaml-cry ocaml-taglib ocaml-lame ocaml-ogg ocaml-vorbis ocaml-samplerate liquidsoap; do \ # cd /home/liquidsoap && git clone https://github.com/savonet/$i && cd $i && opam pin add --yes --no-action .; \ # done @@ -40,10 +40,13 @@ RUN mkdir /home/liquidsoap/tracks RUN chown liquidsoap:liquidsoap /home/liquidsoap/tracks RUN mkdir /home/liquidsoap/recordings RUN chown liquidsoap:liquidsoap /home/liquidsoap/recordings +RUN mkdir /home/liquidsoap/hls +RUN chown liquidsoap:liquidsoap /home/liquidsoap/hls WORKDIR /home/liquidsoap/radio RUN chown 1000:1000 /home/liquidsoap/tracks RUN chown 1000:1000 /home/liquidsoap/recordings +RUN chown 1000:1000 /home/liquidsoap/hls EXPOSE 9000 CMD ["/bin/bash", "-c", "eval `opam config env` && liquidsoap radio.liq"] diff --git a/liquidsoap/radio.liq b/liquidsoap/radio.liq index c7a40ce..5fa12f6 100755 --- a/liquidsoap/radio.liq +++ b/liquidsoap/radio.liq @@ -5,11 +5,11 @@ set("log.file",true) set("log.file.path","/var/log/liquidsoap.log") set("log.stdout",true) -set("log.level",5) +set("log.level",3) -#set("server.telnet",true) -#set("server.socket",true) -#set("server.socket.path","/home/liquidsoap/tracks/liquidsoap.sock") +set("server.telnet",true) +set("server.socket",true) +set("server.socket.path","/home/liquidsoap/tracks/liquidsoap.sock") set("harbor.bind_addrs",["0.0.0.0"]) @@ -69,6 +69,8 @@ stop_dump_f = ref (fun () -> ()) live_dj = ref empty() live_video_audio = ref empty() +live_video = ref empty() +vj_video = ref empty() def get_user(user,password) = if user == "source" then @@ -136,7 +138,7 @@ def my_request_function () = end end -backup_playlist = cue_cut(audio_to_stereo(request.dynamic(id="requests", timeout=60.0, my_request_function))) +backup_playlist = audio_to_stereo(request.dynamic(id="requests", timeout=60.0, my_request_function)) def format_time(~sec,~min,~hour,~mday,~mon,~year, ~wday,~yday,~isdst) = @@ -219,24 +221,25 @@ def pub_metadata(m) = # log("desc: #{desc}"); end -live_video_audio := audio_to_stereo(drop_video((input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=60.0, max=120.0, "-i http://streampusher.com:1024/dash/datafruits.mpd")))) -#live_video_audio := audio_to_stereo(drop_video((input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=30.0, max=60.0, "-i http://rtmp:1024/hls/datafruits.m3u8")))) -#live_video_audio := audio_to_stereo(drop_video((input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=30.0, max=60.0, "-i http://rtmp:1024/dash/datafruits.mpd")))) -#live_video_audio := audio_to_stereo(drop_video((input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=30.0, max=60.0, "-i https://vj.bluelighttapes.com/hls/datafruits.m3u8")))) +live_video := input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=60.0, max=120.0, "-i https://viz.streampusher.com:16666/hls/datafruits.m3u8") +vj_video := input.external.ffmpeg(show_command=true, restart_on_error=true, buffer=60.0, max=120.0, "-i https://viz.streampusher.com:16666/vj/datafruits.m3u8") -#live_video = audio_to_stereo(drop_audio(input.external.ffmpeg("https://vj.bluelighttapes.com/hls/datafruits.m3u8"))) - -#vj_video_only = drop_audio((input.external.ffmpeg("https://vj.bluelighttapes.com/hls/datafruits.m3u8"):source(2,1,0))) +live_video_audio := audio_to_stereo(drop_video(!live_video)) live_dj := map_metadata(new_meta, !live_dj,update=false) -live_dj := pipe(process='./stereo_tool_cmd_64 - - -s ./stereotool.sts', buffer=10.0, !live_dj) -live_video_audio := pipe(process='./stereo_tool_cmd_64 - - -s ./stereotool.sts', buffer=10.0, !live_video_audio) +live_audio = fallback(id="live_audio_fallback", track_sensitive=false, [!live_video_audio, !live_dj]) +live_audio = pipe(process='./stereo_tool_cmd_64 - - -s ./stereotool.sts', buffer=10.0, live_audio) source = fallback(id="fallback",track_sensitive=false, [!live_video_audio, !live_dj, mksafe(backup_playlist)]) -#video_source = fallback([live_video, vj_video]) +single_video = noise() + +video_source = fallback(id="video_fallback",track_sensitive=false, + [!live_video, + mux_audio(drop_audio(!vj_video), audio=source), + mux_audio(single_video, audio=source)]) source = if tunein_metadata_updates_enabled == "true" then on_track(tunein.submit(partnerid=tunein_partner_id,partnerkey=tunein_partner_key,stationid=tunein_station_id), source) else source end @@ -257,4 +260,7 @@ clock.assign_new(id="mp3_icecast", [output.icecast(%mp3,id="icecast", url="", encoding="UTF-8", mksafe(buffer(source)))]) -# output.external.ffmpeg +output.file.hls.ffmpeg(playlist="#{radio_name}.m3u8", + directory="/home/liquidsoap/hls", + fallible=true, + video_source)