Streaming to batc.tv with Raspberry Pi

From BATC Wiki
Jump to: navigation, search

With a software release in early August 2017 the Portsdown can stream directly to batc.tv from the composite video input on the EasyCap dongle, enabling it to be used as a low power consumption streaming appliance at repeater sites.

Software release 201708150 (mid August 2017) introduced functionality specifically for Repeater Streamers. There are 2 modes: one for always-on streaming, and one for hardware-switched streaming. Full details are below, but the first step is to set up the stream so that it works in the normal manner.

Setting up Your Stream

You do not need a Touchscreen to operate in streaming mode but you will need to enter your stream name via the console menu. Note all other parameters are pre-set to H264 encoding at 576Kbit/s without audio or 512Kbit/s with 2 channels of audio.

To enter your stream name, log in to console mode as normal and select output mode from the main menu:


Screen2.jpg

Select 3: Output mode


Screen3.jpg

Select: BATC


Screen4.jpg

Enter the "stream" listed on your BATC account page below the FMS URL:

Stream.JPG

Repeater Streaming Functions

Important - Change Your Password First!

If you are going to use your Portsdown to stream a Repeater, 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. Before setting up the repeater streaming you should change the 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, use the up arrows to scroll to the top of the command history to find the line

/home/pi/rpidatv/scripts/menu.sh menu

and press enter to return to the console menu. Alternatively, you can type the line in. Don't forget to write the password down (yes!) and put it out of view, but attached to your streaming hardware (on the underside of the box?). If a hacker has physical access to your streaming hardware, you have bigger problems than him simply knowing the password.

You can now set your Portsdown to stream a repeater in one of 2 modes:

Continuous Streaming Mode

The first thing to do is to set up your Portsdown to boot-up into Constant Streaming Mode. From the console, go to the System Setup Menu, and select option 1, Autostart. Then use the arrow keys to highlight "Cont_Stream_boot" and then (very important) press the space bar to select it. Then press enter.

You can now test the streaming from the console by selecting "Shutdown and Reboot Options". Then select Option 2, "Reboot Now". If that works, and you are happy with the stream, you can disconnect your PC and leave the streamer to run.

The streamer will stop (for 5 seconds) and restart once every 12 hours to prevent the build-up of excessive latency. If the Raspberry Pi has been able to access the time over the internet, this will happen at 0300 and 1500 UTC each day. Otherwise it should happen at 3 hours and 15 hours after startup and repeat every 24 hours.

Keyed Streaming Mode

In keyed streaming mode, the stream is only sent when a GPIO pin is raised from 0v to 3.3v. An LED connected through a current limiting resistor (470 ohm?) is illuminated when the stream is active. By default, the key signal is input on pin 12 of the GPIO connector. This input is also known as WiringPi 1 or BCM 18. The default pin for the indication LED is pin 7 (WiringPi 7 or BCM 4). These pins are marked as 12 and 7 on the Digithin connector on the Portsdown GPIO Extender Card.

If you want to use different pins, refer to this chart https://wiki.batc.tv/PTT_and_band_switching#Summary_of_GPIO_connections to look up the WiringPi Numbers and then edit line 209 of rpidatv/scripts/startup.sh.

/home/pi/rpidatv/bin/keyedstream 1 7

The WiringPi number for the switch is first, followed by the WiringPi number for the indicator.

Once you have the hardware in place, you can set up your Portsdown to boot-up into Keyed Streaming Mode. From the console, go to the System Setup Menu, and select option 1, Autostart. Then use the arrow keys to highlight "Keyed_Stream_boot" and then (very important) press the space bar to select it. Then press enter.

You can now test the streaming from the console by selecting "Shutdown and Reboot Options". Then select Option 2, "Reboot Now". Test that the stream stops and restarts in response to the swicth and that the LED works. If you are happy with the stream, you can disconnect your PC and leave the streamer to run.

The streamer will stop and, if keyed on, restart once every 12 hours to prevent the build-up of excessive latency. If the Raspberry Pi has been able to access the time over the internet, this will happen at 0300 and 1500 UTC each day. Otherwise it should happen at 3 hours and 15 hours after startup and repeat every 24 hours.