OP25 liquidsoap service startup issue

Status
Not open for further replies.

WX4JCW

Member
Premium Subscriber
Joined
Jun 26, 2006
Messages
3,501
Reaction score
1,024
Location
Stow, Ohio
Good Afternoon,

ok I am having a bit of an issue with a remote setup on a PI 4 that I am using for a private stream
I followed all instructions to the letter and upon reboot OP25 will start, I am running it with the Web Interface in the service, everything works fine and I have a good digital signal coming in

the problem is that the OP25 liquid service seems to start at boot but it will not connect to icecast on its own, if i run a terminal window and run op25.liiq it will connect to icecast and the stream is perfect

I must be missing something, Any Ideas?

my op25.liq looks like this

Code:
#!/usr/bin/liquidsoap

# Example liquidsoap streaming from op25 to icecast
# (c) 2019, 2020 gnorbury@bondcar.com, wllmbecks@gmail.com
#

set("log.stdout", true)
set("log.file", false)
set("log.level", 3)

# Make the native sample rate compatible with op25
set("frame.audio.samplerate", 8000)

input = mksafe(input.external(buffer=0.02, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -x 2 -s"))
# Consider increasing the buffer value on slow systems such as RPi3. e.g. buffer=0.25
# Longer buffer results in less choppy audio but at the expense of increased latency.



# OPTIONAL AUDIO SIGNAL PROCESSING BLOCKS
# Uncomment to enable
#
# High pass filter
#input = filter.iir.butterworth.high(frequency = 200.0, order = 4, input)

# Low pass filter
#input = filter.iir.butterworth.low(frequency = 3250.0, order = 4, input)

# Normalization
input = normalize(input, gain_max = 3.0, gain_min = -3.0, target = -16.0, threshold = -40.0)



# LOCAL AUDIO OUTPUT
# Uncomment the appropriate line below to enable local sound
#
# Default audio subsystem
#out (input)
#
# PulseAudio
output.pulseaudio(input)
#
# ALSA
#output.alsa(input)



# ICECAST STREAMING
# Uncomment to enable output to an icecast server
# Change the "host", "password", and "mount" strings appropriately first!
# For metadata to work properly, the host address given here MUST MATCH the address in op25's meta.json file
#
output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), description="op25", genre="Public Safety", url="", fallible=false, icy_metadata="false", host="localhost", port=8000, mount="mountpoint", pa$

and my op25 liquid service file looks like this

Code:
[Unit]
Description=op25-liq
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

[Service]
User=pi
Group=pi
WorkingDirectory=/home/pi/op25/op25/gr-op25_repeater/apps
ExecStart=/usr/bin/liquidsoap op25.liq
RestartSec=5
Restart=on-failure

[Install]
WantedBy=multi-user.target

and here is the system log
Code:
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 >>> LOG START
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [main:3] Liquidsoap 1.3.3
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.2.3 dtools=0.4.0 duppy=0.7.2 duppy.syntax=0.7.2 cry=0.6.2 mm=0.3.1 xmlplaylist=0.1.3 lastfm=0.3.0 ogg=0.5.2 vorbis=0.7.1 opus=0.1.2 speex=0.2.1 mad=0.4.4 flac=0.1.3 flac.ogg=0.1.3 dynlink=[distributed with Ocaml] lame=0.3.2 shine=0.2.0 gstreamer=0.2.0 frei0r=0.1.0 theora=0.3.1 gavl=0.1.5 bjack=0.1.4 alsa=0.2.3 ao=0.2.0 samplerate=0.1.2 taglib=0.3.1 magic=0.7.3 camomile=0.8.5 yojson=1.3.2 faad=0.4.0 soundtouch=0.1.7 portaudio=0.2.1 pulseaudio=0.1.2 ladspa=0.1.4 dssi=0.1.1 sdl=0.9.1 camlimages=4.2.0 lo=0.1.0 gd=1.0a5
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [gstreamer.loader:3] Loaded GStreamer 1.14.4 0
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [dynamic.loader:3] Could not find dynamic module for fdkaac encoder.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [frame:3] Using 8000Hz audio, 25Hz video, 8000Hz master.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [frame:3] Frame size must be a multiple of 320 ticks = 320 audio samples = 1 video samples.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [frame:3] Targetting 'frame.duration': 0.04s = 320 audio samples = 320 ticks.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [frame:3] Frames last 0.04s = 320 audio samples = 1 video samples = 320 ticks.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Created thread "generic queue #1".
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Created thread "generic queue #2".
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Created thread "non-blocking queue #1".
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Created thread "non-blocking queue #2".
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [input.external_7213:3] Starting process
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [clock.wallclock_pulse:2] Error when starting output pulse_out(liquidsoap:): Pulseaudio error: Connection refused!
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [clock.wallclock_pulse:3] Raised by primitive operation at file "pulseaudio.ml" (inlined), line 47, characters 6-67
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [clock.wallclock_pulse:3] Called from file "io/pulseaudio_io.ml", line 83, characters 13-190
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [clock.wallclock_pulse:3] Called from file "tools/start_stop.ml", line 99, characters 6-16
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [clock.wallclock_pulse:3] Called from file "clock.ml", line 237, characters 19-37
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [mountpoint:3] Connecting mount mountpoint for source@localhost...
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [mountpoint:3] Connection setup was successful.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Created thread "wallclock_pulse" (1 total).
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [clock.wallclock_pulse:3] Streaming loop starts, synchronized by active sources.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [mksafe:3] Switch to safe_blank.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [main:3] Shutdown started!
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [main:3] Waiting for threads to terminate...
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [mountpoint:3] Closing connection...
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [clock.wallclock_pulse:3] Streaming loop stopped.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Thread "wallclock_pulse" terminated (0 remaining).
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [main:3] Threads terminated.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Shutting down scheduler...
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Scheduler shut down.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [main:3] Cleaning downloaded files...
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [main:3] Freeing memory...
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Thread "non-blocking queue #1" terminated.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Thread "generic queue #2" terminated.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Thread "generic queue #1" terminated.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 [threads:3] Thread "non-blocking queue #2" terminated.
Dec 28 16:04:46 jason liquidsoap[458]: 2020/12/28 16:04:46 >>> LOG END
Dec 28 16:04:47 jason systemd[1]: op25-liq.service: Succeeded.
 
Last edited:

boatbod

Member
Joined
Mar 3, 2007
Messages
3,672
Reaction score
1,069
Location
Talbot Co, MD
It's an easy fix...
Comment out this output line:
Code:
# PulseAudio
output.pulseaudio(input)
It will disable local audio but it will also allow liquidsoap to start in a headless environment before pulseaudio is normal available.
 

WX4JCW

Member
Premium Subscriber
Joined
Jun 26, 2006
Messages
3,501
Reaction score
1,024
Location
Stow, Ohio
muchos cracias, works perfect now
 
Last edited:

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,174
Reaction score
422
Location
NE Wisconsin
If you should find that you want/need pulseaudio for use with any components in liquidsoap then you can solve the problem on the RPi by staring pulseaudio from the crontab.

Note: The first time you access crontab in edit mode it will ask you for an editor preference. I want to recall there's two choices, VI and NANO.
Chose the one you're most familiar with then add the line shown in red below after entering in edit mode, save then reboot the Pi. Now you should not have any issues using pulseaudio with liquidsoap.

crontab -e
@reboot pulseaudio --start
 

WX4JCW

Member
Premium Subscriber
Joined
Jun 26, 2006
Messages
3,501
Reaction score
1,024
Location
Stow, Ohio
If you should find that you want/need pulseaudio for use with any components in liquidsoap then you can solve the problem on the RPi by staring pulseaudio from the crontab.

Note: The first time you access crontab in edit mode it will ask you for an editor preference. I want to recall there's two choices, VI and NANO.
Chose the one you're most familiar with then add the line shown in red below after entering in edit mode, save then reboot the Pi. Now you should not have any issues using pulseaudio with liquidsoap.

crontab -e
@reboot pulseaudio --start
thank you, yes already have that setup, seems like one tiny # was holding me up, just did several test reboots and it is working consistently, the pi is hardlined with CAT 5 into my dad's router and since I won't be there I needed to make sure it would work on reboot in the event of a power failure
 

tent405

Member
Joined
Feb 16, 2021
Messages
5
Reaction score
0
I am having just a terrible time trying to get liquidsoap to work. Can anyone explain to me what I'm doing wrong?

Why won't liquidsoap recognize any of the commands I'm giving it, like mksafe, or input.extermal??

I'm running ubuntu20.04..there are no liquidsoap-plugin* packages, does that mean I need to build liquidsoap plugins myself?

user@ubuntu20:~/op25/op25/gr-op25_repeater/apps$ ./op25.liq
At line 6, char 8-15:
Error 4: Undefined variable mksafe
user@ubuntu20:~/op25/op25/gr-op25_repeater/apps$ cat op25.liq
#!/usr/bin/liquidsoap
set("log.stdout", true)
set("log.file", false)
set("log.level", 1)
set("frame.audio.samplerate", 8000)
input = mksafe(input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -x 1.5 -s"))
input = compress(input, attack = 2.0, gain = 0.0, knee = 13.0, ratio = 2.0, release = 12.3, threshold = -18.0, rms_window = 1.0)
input = normalize(input, gain_max = 6.0, gain_min = -6.0, target = -16.0, threshold = -65.0)
output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), description="LPD + Westcom", genre="Public Safety", url="", fallible=false, icy_metadata="false", host="localhost", port=8000, mount="op25", password="xxxxxx", mean(input))
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,174
Reaction score
422
Location
NE Wisconsin
I am having just a terrible time trying to get liquidsoap to work. Can anyone explain to me what I'm doing wrong?

Why won't liquidsoap recognize any of the commands I'm giving it, like mksafe, or input.extermal??

I'm running ubuntu20.04..there are no liquidsoap-plugin* packages, does that mean I need to build liquidsoap plugins myself?

user@ubuntu20:~/op25/op25/gr-op25_repeater/apps$ ./op25.liq
At line 6, char 8-15:
Error 4: Undefined variable mksafe
user@ubuntu20:~/op25/op25/gr-op25_repeater/apps$ cat op25.liq
#!/usr/bin/liquidsoap
set("log.stdout", true)
set("log.file", false)
set("log.level", 1)
set("frame.audio.samplerate", 8000)
input = mksafe(input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -x 1.5 -s"))
input = compress(input, attack = 2.0, gain = 0.0, knee = 13.0, ratio = 2.0, release = 12.3, threshold = -18.0, rms_window = 1.0)
input = normalize(input, gain_max = 6.0, gain_min = -6.0, target = -16.0, threshold = -65.0)
output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), description="LPD + Westcom", genre="Public Safety", url="", fallible=false, icy_metadata="false", host="localhost", port=8000, mount="op25", password="xxxxxx", mean(input))

There is an issue with the way Liquidsoap 1.4.1 was implemented in Ubuntu 20.04 causing the error message regarding the undefined variable mksafe. However, this is easy to fix, open a terminal and input the lines shown bold below to correct the issue. Once complete, your op25.liq script should execute normally.

sudo mkdir /usr/share/liquidsoap/1.4.1
sudo ln -s /usr/share/liquidsoap/libs /usr/share/liquidsoap/1.4.1/
 
Last edited:

tent405

Member
Joined
Feb 16, 2021
Messages
5
Reaction score
0
There is an issue with the way Liquidsoap 1.4.1 was implemented in Ubuntu 20.04 causing the error message regarding the undefined variable mksafe. However, this is easy to fix, open a terminal and input the lines shown bold below to correct the issue. Once complete, your op25.liq script should execute normally.

sudo mkdir /usr/share/liquidsoap/1.4.1
sudo ln -s /usr/share/liquidsoap/libs /usr/share/liquidsoap/1.4.1/
That fix might have worked in ubuntu but not in other distributions. Are you aware of what is the underlying liquidsoap issue that causes this problem?
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,174
Reaction score
422
Location
NE Wisconsin
That fix might have worked in ubuntu but not in other distributions. Are you aware of what is the underlying liquidsoap issue that causes this problem?

There are any number of reasons for Liquidsoap to abort execution upon startup. If you're looking for someone to figure this out for you, then it would be REALLY HELPFUL to post something useful like what Linux Distro you're using, what Liquidsoap version is installed, and above all, the exact text of the error message.
 
Status
Not open for further replies.
Top