I generally don't like when a website gives you a whole personal story about whatever you are looking for. Chances are, whoever is doing web searches trying to figure out... whatever, they have been to several other sites trying to get a sense of what's going on. This is not what I do here.
You're here and there's a high chance you know what you are doing. To that end, feel free to skip the background section and dive right in.
Twonky Media Server is a fine DLNA UPnP server that supports lots of media files, a rare example of the right combination of functionality and price. I can hear you asking: "But, Twonky is not free. Why should I bother?." The answer is simple: if you want a media server that doesn't take over your RPi that supports every file type imaginable, this is the way to go.
The big caveat here, apart from the cost, is that I'm writing this for the audiophiles amongst us. Twonky is one of the few DLNA servers for Linux that supports the streaming of DSD (DSF and DFF) files. For most people, this is irrelevant, as the playback of DSD files requires expensive equipment, not to mention the fair sourcing of said files in the first place. Most people will be happy streaming from their paid services and not bother with this.
If you are interested in DSD as a format, Wikipedia has a good write up on it.
If you're running a headless RPi, you'll also need a second computer to access the RPi.
I'm going to skip the basic setup of a brand new Raspberry Pi here. Should you need some assistance getting started from zero, I'd recommend Rasbperry Pi's own tutorial.
However, there's a few things I should note about the state in which the RPi need to be before we can really get going:
Twonky has had a rocky existence. While someone is still supporting the app, the information to get things done is not easily reachable. Tutorials on the web are pretty few and far between, with some including pictures of screen content (not actual screen shots, mind you). This tutorial should fill that gap.
The official website for Twonky contains their most recent version for the major platforms (Windows, MacOS, and Linux AMD64). However, they fail to mention that there's a trove of other files in their old forum, which include the files compiled for ARM, amongst many, many other platforms. Let's get started with the commands:
There is a possibility that after running the last command, the one that manually launches the application, an error along these lines appears:
Starting /usr/local/twonky/twonkystarter /usr/local/twonky/twonky.sh: 188: /usr/local/twonky/twonkystarter: not found
If this is the case, run the following command to install some missing dependencies:
sudo apt install libc6:armhf libc6-dbg:armhf libc6-dev:armhf
At this point, you have a working copy of Twonky installed. However, having to run the start command each time the RPi reboots is less than ideal.
Next, we'll setup Twonky as a proper service. This way the OS makes sure the media server is brought up on boot every time; no user intervention required.
[Unit] Description=Twonky Media Server service After=syslog.target network.target [Service] Type=simple ExecStart=/usr/local/twonky/twonkystarter ExecStop=/usr/local/twonky/twonky.sh stop PIDFile=/run/mediaserver.pid Restart=always [Install] WantedBy=multi-user.target
● twonky.service - Twonky Media Server service Loaded: loaded (/etc/systemd/system/twonky.service; disabled; vendor preset: enabled) Active: inactive (dead)
Created symlink /etc/systemd/system/multi-user.target.wants/twonky.service → /etc/systemd/system/twonky.service.
● twonky.service - Twonky Media Server service Loaded: loaded (/etc/systemd/system/twonky.service; enabled; vendor preset: enable Active: active (running) since Mon 2020-04-20 21:59:25 BST; 1h 42min ago Main PID: 30188 (twonkystarter) Tasks: 18 (limit: 4035) Memory: 9.4M CGroup: /system.slice/twonky.service ├─30188 /usr/local/twonky/twonkystarter └─30189 /usr/local/twonky/twonkyserver
If you followed my advise about turning on ufw a few steps ago, you won't be able to reach the configuration website of the media server just yet. This is because the firewall simply doesn't know let some of the traffic in the specific port go through. Thankfully, ufw is easy to deal with when it comes to this.
Rule added Rule added (v6)
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether ab:cd:ef:fe:dc:ba brd ff:ff:ff:ff:ff:ff
inet 192.168.1.2/24 brd 192.168.1.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::95a9:f608:be77:2bbe/64 scope link
valid_lft forever preferred_lft forever
If you're using Wi-Fi, you may be looking for the wlan0 entry in the ip address output.
I hope you've found this useful. Here are a few take-aways from this:
WORKDIR1="/usr/local/twonky" WORKDIR2="`dirname $0`" PIDFILE=/run/mediaserver.pid
... # Comma separated list of IP addresses to bind to (optionally can include a netmask e.g. 192.168.3.0|255.255.255.0 will match address range 192.168.3.x). Default: blank = all networks - only works with ipv4 addresses ip=0.0.0.0 # Optional. Replace this with your IP, if the RPi has a static IP. ... # Specifies a comma separated list of interface names to ignore ignoreiface=wg0 # The Wireguard interface name could be different for you. Adjust accordingly. ...