Sharpfin streaming media server for Reciva radios - Version 2.1

25th August 2022
Latest update 30th Sept 2022

This page describes Version 2.1 of the Sharpfin streaming media server for Reciva radios which has several improvements over Version 1.

Version 2 improvements are:

The processing power on the Reciva based radios is very limited so not everything is possible. For example only lower bitrate streams (128kps and below) are successful over https connections without buffering delays. There are many compromises used internally to get the most from the hardware within the constraint of working as a media server rather than a replacement of the main radio software.

As with version 1 of the media server this builds on the Sharpfin project which gives access to the internal software of the radios. The media server runs on the radio itself to retain the self-contained radio format. Your favorite stations can be entered via a webpage on the radio and then selected from the radio front panel almost like normal, but going via the Media Player. From version 2.1 you can also browse externally hosted lists of stations from the +Feeds menu within the Media Player.

New installation

  1. Install Sharpfin on the radio using the standard patch server process. I found that patch server 0.5 worked better than the newer 0.7 version (available here or here).
  2. Install the sharpfin-base and sharpfin-www_0.9 packages. These give you a simple web interface on the radio.
  3. Install the Sharpfin Enhance Pack 2.0 through the web interface on the radio. This is described here:
  4. Install the media server. 

You can also find a guide to working with Reciva radios here: Patching the Tangent Quattro Reciva radio

File integrity checks (sha256sum):
Sharpfin-media-server-2.1.install
34bece6e3805e78a92c0aa81c9a2863024c42fc5691e5ca152f61a28c036b53c
sharpfin-ep2.install
0d043a2d19cd3c72315c5ac2e8793f8e2194725529645c6b9d97a223178808e3

Upgrade to version 2.1

For upgrade to Version 2.1 just start at step 4 of the installation instructions. There is no need to manually remove any previous version.

If you have created your own station lists these will be preserved through the upgrade as long as they don't use the same name as any of the example station lists included with the media server. To avoid any risk of losing them you should download them from the radio web interface before doing the upgrade.

If you are already on version 2.1 you will find that version 2.1.2 is a minor upgrade to improve download of the external station feeds.

How to use the media server

Use of the media server is unchanged from Version 1. The example station lists show examples of HTTPS and HLS/AAC format streams (see within the UK-> BBC National folder via the radio Manage Stations page).

New - browsing external stations feeds. These are under the +Feeds menu alongside locally hosted stations. The first external feed is provided by www.radiofeeds.co.uk. You can add up to 5 external station feeds through the radio Manage Stations page. If you would like to host an external list of stations (e.g. for your part of the world, or for your favourite stations) the instructions are here.

Background and source files

The internal media server is based on existing open source software adapted for use on the radio.

The Version 2 media server is significantly more complex than Version 1. The original media server simply routed MP3 streams to the media player but despite may different attempts it was not possible to remove buffering issues as real time incoming data just could not match the expectations of the Reciva media player (it was designed to play stored media, not a stream arriving in real time). The solution to this was to use FFmpeg to transcode incoming data to an uncompressed format (Sun Microsystems AU audio format, some models of radio may also identify the stream as a WAV format), thereby generating lots more data to keep the Reciva media player happy. This transcode process then opened up the possibility to convert AAC format streams in a similar way, and also to access https streams.

A downside of the transcoding process is that a high bitrate incoming stream can generate (i) a higher CPU load than the radio can handle in real time playback, and (ii) so much data it's just not possible for the media player to handle it. Very high rate incoming streams are therefore downsampled to avoid this saturation problem. It will lead to some loss of potential audio quality - but hopefully not too much of an issue. The bitrates displayed while stations are playing are the AU format data rate flowing to the media player, not the real radio stream rates. Any attempt to switch format fails (e.g. directly forward incoming mp3 data at high bitrates, but use the decoding to AU format at low bitrates). The media player cannot handle a change of stream format after the stream has started to play, and it must be informed via a MIME header of the data format ahead of the stream starting.

Cross-compilation for the Arm processor followed the same route as for version 1. The resulting file was found to be too large to fit on the radio, but could be compressed using the UPX executable packer (https://upx.github.io/). This can compress executable files which are then transparently decompressed using gzip (already on the radio) at run time. UPX cannot compress library files, so compilation was changed to create a static uShare binary integrating all the required parts of the other libraries so as much could be compressed by UPX as possible.

Even with compression the resulting media server is about 612kB - absolutely tiny, but quite large by Reciva radio storage standards! This is therefore located in the /opt/ folder of the filesystem which is on the /dev/mtdblock/4 partition and usually has around 780 to 800kB space available. A link is made so that uShare appears in the normal /usr/bin folder. This allows the media server and large lists of stations to be stored on the radio without reaching its storage limits.

Testing

The installation and running of the version 2 media server has been tested and works on the following radios and service packs:

As with any Sharpfin modifications to the radio the media server comes with no warranty and you proceed at your own risk.