OP25 OP25 and Icecast2 Private Server

Status
Not open for further replies.
Joined
Aug 25, 2016
Messages
55
I have been looking through many previous OP25 threads about streaming and they all explain how to stream to Broadcastify and some reference private servers via Icecast but don't explain it in much detail.

Here's what I'm looking for: a single stream from the OP25 process I have running on a PC with metadata.

What I know is that I need to modify the op25.liq and meta.json in the ~/op25/op25/gr-op25_repeater/apps folder and the icecast.xml in my /etc/icecast2 folder. With Broadcastify streaming, the hostname, password, and mountpoint are laid out by them, but I'm trying to find out what to use for a private server.

Thanks for all your help, OP25 is just awesome and I'm trying to learn more about it.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,398
Location
Talbot Co, MD
I have been looking through many previous OP25 threads about streaming and they all explain how to stream to Broadcastify and some reference private servers via Icecast but don't explain it in much detail.

Here's what I'm looking for: a single stream from the OP25 process I have running on a PC with metadata.

What I know is that I need to modify the op25.liq and meta.json in the ~/op25/op25/gr-op25_repeater/apps folder and the icecast.xml in my /etc/icecast2 folder. With Broadcastify streaming, the hostname, password, and mountpoint are laid out by them, but I'm trying to find out what to use for a private server.

Thanks for all your help, OP25 is just awesome and I'm trying to learn more about it.
sudo apt-get install icecast2
 
Joined
Aug 25, 2016
Messages
55
sudo apt-get install icecast2
I've done that much, I just don't know what values to use for the hostname and mountpoint. From what I can tell it seems like my external IP would be used for the hostname and I just come up with a mountpoint and be consistent with it throughout the files, but I can't find a definitive answer.

Also, ices2 seems to come up a lot, is that a package that would be needed or does it used for a different situation?
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,015
Location
NE Wisconsin
When you initially install icecast2 the default passwords (three of them) all default to "hackme" unless you override them when
the installer runs. It's ok to leave these as they are as long as you're not setting up port forwarding to allow connection from outside of you
home network.

The next step is to install liquidosap if you have not already done so. Liquidsoap is driven by the default script packaged with boatbod op25 that is named op25.liq. To get started, we'll skip the local audio (speaker) option and just focus on sending audio to the icecast server.

Make your op25.liq look like this:

#!/usr/bin/liquidsoap
# Example liquidsoap streaming from op25 to icecast
# (c) 2019, gnorbury@bondcar.com
#
set("log.stdout", true)
set("log.file", false)
set("log.level", 1)
# Make the native sample rate compatible with op25
set("frame.audio.samplerate", 8000)
input = mksafe(input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -s -x 2"))
# 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.
# LOCAL AUDIO
# 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="op25", password="hackme", mean(input))



Make you rx.py command line look like this:

./rx.py --args 'rtl' --gains 'lna:49' -T trunk.tsv -q 0 -S 1000000 -D cqpsk -w -2 -V 2> stderr.2



Note:

Substitute -q and add your -o and -d values with those already known to work on your local system.


Follow the instructions in README-rpi3-liquidsoap to setup, enable services, and to start them.
Reboot then using a browser or a program like VLC or Winamp, connect to http://192.168.1.200:8000/op25 substituting the IP address with the actual LAN IP of the device that op25 is running on. You should now get audio from op25 that is delayed by approximately 20-30 seconds behind real time. This time can be shortened up with some editing of your icecast.xml file later.

Bill






 
Joined
Aug 25, 2016
Messages
55
Thank you so much for the great information, I was able to get the streaming to work on my LAN!

If you don't mind, I have a few more questions.
How do I get the metadata to go along with the audio? I have edited the meta.json file with the password, mount point and localhost:8000, but nothing shows on the "Currently Playing" part of the icecast page. Also, what changes should I make to the icecast.xml file to decrease the delay? The OP25 process is running on a small PC, not an RPi, so is there any need to change values such as the buffer in the op25.liq file?

My plan is to setup port forwarding to allow external access, but that is the last step and should only affect the hostname, which should be the external IP if I'm not mistaken.

Thanks again for your help!
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,015
Location
NE Wisconsin
To begin with, you'll need to crate a tag file that you call from inside of trunk.tsv file. There are four example files distributed with op25 that can be edited or used as a template. They are; nyseg, onondaga, ontario, and tompkins. Each line in the tag file begins with the TGID in decimal format that's followed by the text of your tag that must be separated from the TGID by a single tab character

Edit edit trunk.tsv to enter the tag file_name just created, then and add -M meta.json to your rx.py command line. Once op25 is restarted it will reference decoded TGID's against those found in your tag file and will then call icemeta.py to send this metadata to the icecast server defined
in your meta.json file. The mountpoint and password must match those that were set in your op25.liq file.

Setup port forwarding to direct inbound Port 8000 TCP traffic to the LAN IP address assigned to your Raspberry Pi. The Raspberry Pi should be preconfigured to operate on a Static LAN IP that dos not conflict with any of the addresses assignable in the routers DHCP pool. Sometimes, it's necessary to change the DHCP server's pool range to allow a few Static LAN IP's within the same subnet.

A Static Public IP or equivalent such that your can reliably connect to your streaming server from the Internet. You have to option to use Dynamic DNS service if your ISP assigned your public address from a pool as most do. Some routers accommodate Dynamic DNS while others don't. In this case you can install a Dynamic DNS Client on your RPi and you'll be good to go.

Don't forget, if you haven't already done so, to change the default icecast password from hackme to something else for security reasons.
Perform a sudo nano /etc/icecast2/icecast.xml to change the existing password found in three places. Remember to change the same
references to the password in op25.liq and meta.json.

While you're at it, to decrease latency of the audio passing to connected clients, edit the lines show below with the new values as indicated.

change <burst-on-connect>1</burst-on-connect> to <burst-on-connect>0</burst-on-connect>
change <burst-size>65535</burst-size> to <burst-size>0</burst-size>

Restart your system to initialize the configuration changes and you're good to go.

Bill
 
Joined
Aug 25, 2016
Messages
55
Great! I was able to get the metadata to get through on the LAN connection and reduce the latency. After doing some research, I found that my router is known for having trouble with adding new port forwarding rules and such, so I may have to try the external IP access portion of this at a later time.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,015
Location
NE Wisconsin
A lot of routers come with predefined services (ports) built in on well know port numbers. You might consider using one of these such as 8080 if it won't let you setup port 8000. You'd only need to edit icecast.xml to change the port number. Just be aware that the op25 http console is typically configured on port 8080 and that would have to be changed if using the console.

Good luck!

Bill
 
Joined
Aug 25, 2016
Messages
55
Thanks for all of the great info, I also implemented the software AGC edit to the op25.liq you mentioned in a post several months back.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,015
Location
NE Wisconsin
Glad you got everything working! The AGC function is really more of a gain limiter, so you may need to adjust the source audio gain to achieve the desired degree of leveling.

From op25.liq (below) the -x 2 is typically enough of a gain increase to work well with most systems. However, it's not uncommon to find voice levels all over the place in the world of digital audio these days. Therefore, you may have to incrementally increase, or decrease this value accordingly.


input = nrj(mksafe(input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -s -x 2")))
 
Joined
Aug 25, 2016
Messages
55
I noticed a problem with the Icecast server, but it may only be on my end/setup. I open the stream from my Linux desktop using the built in media player and after a while (mainly when the PC shuts off the screen) the player will give an error saying "Server does not support seeking." I can immediately start playing again by clicking play and it picks the stream back up.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,015
Location
NE Wisconsin
This is most likely related to the Desktop environment or the player itself. What flavor of Linux and what specific media player are you using?
Is your Linux system running natively or on a Virtual Machine? Check the media player options to see if there is a setting that allows it to continue running during screen lock (user input timeout).

On my Ubuntu VM's I disable screen lock and screen blanking and let the host operating system blank the screen and that let's me work on other tasks and not have to come back and login aging following a timeout. Generally, all of my instances of op25 run on Raspberry Pi's whereby my preferred player on Windows and Android devices is Winamp. VLC is also another good player.

Bill
 
Joined
Aug 25, 2016
Messages
55
I’m running Linux Mint natively, I’m using the built in media player (I believe it’s just called “media player”). I’ll look through the options to see if there is a run in background setting or such. This problem only exists on the client side, the host/server (also a Linux Mint PC) never hiccups or fails (knock on wood haha).
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
1,015
Location
NE Wisconsin
I have been testing Rhythmbox V3.4.2 on Linux Mint 19.3 running as a VM on Windows-10 Pro streaming audio from the Icecast server collocated with one of my instances of op25 running on a Raspberry Pi-4B. There has been no loss of audio, and no evidence that the player goes into a hibernation state when the screen saver times out. Streaming continues with good audio.

Perhaps you might try installing and using Rhythmbox as a player to see if that solves your problem?

Bill
 

jmayson

Member
Database Admin
Joined
Dec 18, 2002
Messages
54
Location
Austin, TX
Thank you all who contributed to this thread. I had the same question and was able to solve the problem and get my own personal scanner online.

BCFY already has my area solidly covered, so I'm not sure how much value I'd add by putting up a stream. But at least now I know how.
 
Status
Not open for further replies.
Top