I'd like to use my raspberry pi as media renderer so I can select playlists on my control point to play music from the media server. I've found some questions to gmediarender but no direct answer how to install it. How can I do that in an easy way?


I'm with Raspbian Lite from Debian stretch. With the raspi you should be connected to your local network and to your audio output (earphone, amplifier etc). First you can check your audio output with this small audio file working.wav. Of course you can take any other audio output test.

pi ~$ sudo apt install alsa-utils
pi ~$ aplay working.wav

If you hear that it's working then install gmediarender with needed plugins:

pi ~$ sudo apt install gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gmediarender

Test installation; you can cancel it with <Ctrl>C.

pi ~$ /usr/bin/gmediarender -f Test -u 42 --logfile /dev/stdout

On your control point (bubbleUPNP or something like) you should find a renderer named Test. Select it and play music from your media server if you have one. If it works then configure /etc/default/gmediarender, set ENABLED=1 and maybe your UPNP_DEVICE_NAME. Don't use "special" characters like umlaut or so. Startup will quit with an error message. Seems gmediarender still do not understand UTF-8 :-(

If you have more then one raspi with gmediarender running on your network you should give each a different UUID. Control points can then distinguish different media renderer in upnp messages. Append something like this to /etc/default/gmediarender:

DAEMON_EXTRA_ARGS="--uuid f4f7681c-3056-11e8-86bd-87a6e4e2c42d"

You can get new UUIDs with the program uuid (install with sudo apt install uuid).

If you have only one interface on your RasPi then you are finished with the setup. Just start gmediarender as service:

pi ~$ sudo systemctl enable gmediarender.service
pi ~$ sudo systemctl start gmediarender.service

I had the problem that I use gmediarender on a RasPi with a wired network connection and with an access point so I have two interfaces with an ip address. Gmediarender binds to one of them and of course to the wrong one. You have to specify the ip address of the interface in /etc/default/gmediarender that should be used. But my interface is configured by DHCP so the ip address may change from time to time. To solve this problem I have made a small bash script that gets the current ip address from the interface and write it to /etc/default/gmediarender. This is the script:

rpi ~$ cat /usr/local/sbin/gmediarender-setip.sh
# This script binds gmediarender to an interface given in "$1".
# Gmediarender needs the ip address of the interface. The current ip address
# is taken from the interface and set in /etc/default/gmediarender.

if [ $# -eq 0 ]; then
    echo 'no interface name given'
    exit 1
IPADDR=$(/sbin/ip -4 -br addr show $1 | /bin/grep -Po "\\d+\\.\\d+\\.\\d+\\.\\d+")
CMD="s/\(DAEMON_EXTRA_ARGS=.*--ip-address=*\)[^ \"]*/\1$IPADDR/"
/bin/sed -i "$CMD" /etc/default/gmediarender

Don't forget to set permissions and make it executable only for root:

rpi ~$ sudo chown root:root /usr/sbin/gmediarender-setip.sh
rpi ~$ sudo chmod 754 /usr/sbin/gmediarender-setip.sh

Then execute this script just before starting gmediarender by extending its service with:

rpi ~$ sudo systemctl edit gmediarender.service

In the empty editor insert these statements using your own interface name, save them and quit the editor:

ExecStartPre=/usr/local/sbin/gmediarender-setip.sh eth0

In /etc/default/gmediarender set at least

# or e.g.
DAEMON_EXTRA_ARGS="--uuid f4f7681c-3056-11e8-86bd-87a6e4e2c42d --ip-address="

Otherwise the script will not find the ip address to be changed. Then start gmediarender as service:

pi ~$ sudo systemctl enable gmediarender.service
pi ~$ sudo systemctl start gmediarender.service

[1] https://github.com/hzeller/gmrender-resurrect
[2] https://joachim-wilke.de/blog/2016/07/10/UPNP-Renderer-auf-dem-Raspberry-Pi/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.