Stream Node Audio to Broadcastify

From AllStarLink Wiki
Jump to navigation Jump to search
Legacy Version - This page is about a legacy version of AllStarLink. See https://allstarlink.github.io/adv-topics/broadcastify/

To broadcast your node's audio on Broadcastify, you will need a Broadcastify account. You can then apply for a feed. This Link provides information about applying for a feed.

After you have your account and feed credentials, you are ready to setup Allstar.

As of 8/5/2023, ezstream, version 1.0.2, contains a bug that prevents it from streaming MP3 data. The following instructions will walk you through the steps to download and compile the necessary packages.

Installation Instructions for Ezstream 1.0.0 and newer

Install Software and Packages

Log into your node and type the following commands.

sudo -s
cd /usr/src

git clone https://gitlab.xiph.org/xiph/ezstream.git
cd ezstream
git checkout master

wget https://gitlab.xiph.org/xiph/ezstream/uploads/ba768fa1349c65b60affd496cf4282ed/ezstream-1.0.2.patch

patch src/stream.c ezstream-1.0.2.patch

apt-get update
apt-get install check libshout-dev libtagc0-dev lame

./autogen.sh
./configure
make
make install

Press control-d to exit from superuser.

This will compile and install ezstream. It will also install lame.

Setup Ezstream

Edit /etc/ezstream.xml with your favorite editor. You will be creating a new file.

Add the following to the file.

<ezstream>
  <servers>
    <server>
      <protocol>HTTP</protocol>
      <hostname>Replace with Broadcastify URL</hostname>
      <port>80</port>
      <password>Replace with your stream password</password>
      <tls>none</tls>
    </server>
  </servers>
  <streams>
    <stream>
      <mountpoint>Replace with your mount point path</mountpoint>
      <format>MP3</format>
      <stream_name>Replace with your feed name</stream_name>
      <stream_url>Your web page</stream_url>
      <stream_genre>Amateur Radio</stream_genre>
      <stream_description>Replace with your stream description</stream_description>
      <stream_bitrate>16</stream_bitrate>
      <stream_channels>1</stream_channels>
      <stream_samplerate>22050</stream_samplerate>
      <stream_public>Yes</stream_public>
    </stream>
  </streams>
  <intakes>
    <intake>
      <type>stdin</type>
    </intake>
  </intakes>
</ezstream>

Save the file.

Update rpt.conf

Edit /etc/asterisk/rpt.conf. Add the following line to the bottom of the node that you want to broadcast.

outstreamcmd = /bin/sh,-c,/usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16 - - | /usr/local/bin/ezstream -qvc /etc/ezstream.xml 
Meaning of outstream parameters:
	-- preset cbr 16 = use constant bit rate 16
	-r = Assume the input file is raw pcm
	-m m = Mode mono
	-s 8 = sample rate 8
	--bitwidth 16 = bit width is 16 (default)

After these changes have been made, you will need to restart asterisk.

Streaming should start immediately after asterisk is restarted.

If you run into any problems, you can add 2>/tmp/ezstreamlog.txt to the end of the outstream command. This will write errors to /tmp/ezstreamlog.txt.

Migrating an existing feed to Ezstream 1.0.0 or newer

If you have an existing feed, you will need to upgrade your existing xml file to the new format. You can use the following commands.

cd /etc
ezstream-cfgmigrate -0 ezstream.xml > ezstream.xml.new
cp ezstream.xml ~/
cp ezstream.new ezstream.xml

Installation Instructions for Eztream 0.5.x and older

Install Packages

Note: These packages are already installed on beta-2.0.0 on Raspberry Pi. You will need to download and install ezstream manually for PC

apt-get update
apt-get install ezstream lame -y

Edit /etc/asterisk/rpt.conf and add this to the bottom of the node stanza for the node you want to broadcast.

outstreamcmd = /bin/sh,-c,/usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16 - - | /usr/bin/ezstream -qvc /etc/ezstream.xml

Meaning of outstream paramaters:
-- preset cbr 16 = use constant bit rate 16
-r = Assume the input file is raw pcm
-m m = Mode mono
-s 8 = sample rate 8
--bitwidth 16 = bit width is 16 (default)

This is the contents of ezstream.xml
You will need to add / edit your passwords etc. for Broadcastify. Place this file in the /etc directory.

<ezstream>
    <url>http://audio3.broadcastify.com:80/mountpoint-provided-by-broadcastify</url>
    <sourcepassword>feed-specific-password-not-same-as-website-login</sourcepassword>
    <format>MP3</format>
    <filename>stdin</filename>
    <stream_once>1</stream_once>
    <reconnect_tries>0</reconnect_tries>
    <svrinfoname>Description </svrinfoname>
    <svrinfourl>http://www.radioreference.com/</svrinfourl>
    <svrinfogenre>Amateur Radio</svrinfogenre>
    <svrinfodescription>Description</svrinfodescription>
    <svrinfobitrate>16</svrinfobitrate>
    <svrinfochannels>1</svrinfochannels>
    <svrinfosamplerate>22050</svrinfosamplerate>
    <svrinfopublic>1</svrinfopublic>
</ezstream>