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 a special "repeater input" streaming channel can be set up on the BATC Streaming Server for any repeaters who wish to implement the facility.
This stream will not be listed on the normal BATC live stream pages as it will only be viewed by the Portsdown stream receiver at the repeater site.
A dedicated Portsdown Stream Receiver is then installed at the repeater site and set up to listen or monitor the allocated "repeater input" streaming channel only.
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 logic to show the incoming stream as if it was a normal RF input channel.
Trusted members of the repeater group are then given access to be able to stream in to the BATC server on this account and will then be able to access and send signals to the repeater using Adobe Media encoder, Vmix or a Portsdown in streaming mode.
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 repeater input into use when the pin goes high (3.3v). https://wiki.batc.org.uk/PTT_and_band_switching#Summary_of_GPIO_connections
A suitable memory card with Raspbian Stretch software and Portsdown Software Version 201807290 or later should be fitted. Note - 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 - to do this, send a request to email@example.com.
Once the account is set up, you will be sent the account details including the stream RTMP input URL and key and the stream output URL.
The stream rtmp input URL and key should be given to your trusted users to configure their streaming software (Portsdown, Vmix OBS, Adobe etc). Be aware that the received input stream will be transmitted over your transmit output and so should only be used by licensed amateurs observing their license conditions.
The output stream URL should not be passed to anyone as it is only used to set up the repeater site stream Receiver as described below.
Setting up the Raspberry Pi
Change the default password
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.
Setting up the stream receiver
When the Raspberry Pi reboots, log in with you new password and the console should be displayed.
From the console select option 4, Receive. The select option 4 on the Receive Menu.
Next, the software will request the stream output URL. This is the stream output URL for your special repeater input channel (NOT your normal repeater output stream) and will be in the form of:
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.
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.
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.
GPIO stream active line
When the reciever sees an incoming stream it will put pin 7 on the Raspbery Pi GPIO high to indicate a valid signal - this can be used to trigger a repeater logic - note this is a 3.3v line and easily damaged. See https://wiki.batc.org.uk/PTT_and_band_switching
The stream receiver will output the received stream on the stadard Raspberry Pi 4 pole AV jack. This should be routed as just another input on your repeater.
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.
During normal running, the stream receiver does not write to the SD Card, so it is unlikely to get corrupted in the event of a power failure.