Stream Receiver

From BATC Wiki
Jump to navigation Jump to search

Introduction

Software Version 201807290 introduced the capability to receive an incoming stream and trigger a repeater to relay it when the stream is active. The concept of operation is that an unlisted "repeater input" stream account is set up on the BATC Streaming Server. Trusted BATC members living near the repeater in question are given access to stream to this account. The Portsdown Stream Receiver is installed at the repeater site and connected to the internet. The Stream Receiver's video and audio output is fed into the repeater video input matrix, and the "stream active" signal is used to switch the repeater to show the incoming stream.

Preparation

You will need a Raspberry Pi 3B or Raspberry Pi 3B+ and a good power supply. This should be connected to the internet at the repeater site, and the video and audio outputs from the 3.5mm jack (connection details here)connected to your repeater input matrix. GPIO pin 7 on the Raspberry Pi should be connected to a suitable interface to switch the input into use when it goes high (3.3v). A suitable memory card with Raspbian Stretch software and Portsdown Software Version 201807290 or later should be fitted. No touchscreen, video dongle or audio dongle is required.

The next requirement is to have a "Repeater Input" stream account set up on the BATC Streaming Server; send a request to admin@batc.tv. Once the account is set up, you will be sent the account details, which will include the input access code and the output stream address. The input access code should be passed to your trusted users, and the output stream address should be used to set up the Stream Receiver as described below. You will not see the stream listed on the BATC Website.

Setting up the Raspberry Pi

Connect to the Raspberry Pi through the console as described in the Console Guide. The first step is to change the default Raspberry Pi password as it will be constantly connected to the Internet. You should not run a Portsdown-configured Raspberry Pi constantly connected to the internet without changing the default password. From the console, select Shutdown and Reboot options. Then select Option 3, "Exit to Linux". At the command prompt type passwd and press enter. It will ask you for the current password (raspberry), but will not echo anything to the screen as you type it in. It should then ask you for the new password (twice). Again it will not show anything on the screen. When complete, type

sudo reboot now

and press enter to return to reboot; you may need to disconnect and reconnect the power. Don't forget to write the password down (yes!) and put it out of view, but attached to your receiver hardware (on the underside of the box?). If a hacker has physical access to your hardware, you have bigger problems than the hacker simply knowing the password.

When the Raspberry Pi reboots, log in with you new password and the console should be displayed.

Console 1.jpg

From the console select option 4, Receive. The select option 4 on the Receive Menu.

Receive Menu.jpg

Next, the software will request the stream address. This will be of the form

rtmp://rtmp.batc.org.uk/live/gb3xxinput

Note that it is not the address with the 6-character key on the end, this should go to those users who are going to send pictures to the stream. Press enter and it will start the stream receiver FOR TESTING. You can now check that the stream is displayed and that your switching circuitry works.

The final, ESSENTIAL, step is to set up the system to boot straight into the receiver. From the Console Main Menu select option 5, System.

System.jpg

Next select option 1, Autostart, and move the red box to the "StreamRX_boot" line and select it with the space bar. The press enter to select it.

Autostart.jpg

The stream receiver will now start at every reboot.

The last thing to do is to reboot the RPi and check that the stream receiver does restart and work.

Operation

The stream receiver is designed to be run unattended for long periods. This is how it operates.

With no incoming stream there is a continuous loop that starts the stream player (omxplayer) every 10 seconds. If there is no stream, the player times out after about 6 seconds and sits idle until it is restarted 4 seconds later.

If the player finds a stream and starts, it sends a status message. The status message is checked by the software, and if the first line starts with "Video" this is taken as an indication that the stream is valid, and the GPIO pin to trigger the repeater switching is set high. Sometimes the player does not start properly and only finds the audio part of the stream. In this case the player is stopped and restarted at the beginning of the next 10 second cycle.

When the stream finishes, the player times out and the GPIO pin is set low. The 10 second cycle starts again.

There is an occasional lock-up condition where the player seems to detect a valid stream, but does not display any video. This triggers the GPIO switch, but leaves the system locked up showing the "Valid Stream Detected" message. To overcome this without requiring repeater keeper intervention, the player is stopped (whatever is happening) once an hour, normally within 10 seconds of the top of the hour.