My ultimate guide to the Raspberry pi audio server I wanted — DLNA
Part 4 — DLNA/UPNP
I also wanted a protocol more standard than MPD on the other OS and in the industry. This protocol is DLNA. It comes with 3 entities :
- Server: will store media informations and database
- Renderer: will actually play media
- Client: will tell renderer to play media from server.
Server Side
So I followed the same idea than from MPD mostly, and installed minidlna on the NAS to store the UPNP database.
/etc/minidlna.conf
media_dir=A,/srv/dev-disk-by-id-md-name-nas-localraid/Musique/music
db_dir=/srv/dev-disk-by-id-md-name-nas-localraid/Musique/dlna
port=8200
friendly_name=”NAS upnp”
inotify=yes
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg
album_art_names=AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg
album_art_names=Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
I also added minidlna to the audio group so that it could watch for changes in the media folders
$ sudo usermod -a -G audio minidlna
$ sudo systemctl restart minidlna
Renderer side
Now I needed to choose a DLNA renderer to complete my requirements. I tried briefly gmediarenderer but gave up for several reasons:
- It’s a quite old project which was unmaintained for years until someone made gmediarenderer-resurrect
- It needs gstreamer as new dependency, which is yet another way to play sound on linux.
- I couldn’t understand documentation and make it work with pulseaudio
I finally turned to UpMPDcli which uses MPD as a backend, convenientely for us. According to its author, UpMPDcli has replaced gmediarenderer in solutions like VolumIO and RuneAudio, so it really seems a better solution. I also thinks it’s cleaner to use MPD as a backend, since it’s already installed and working and it makes the chaining of audio services more obvious and easy to control.
We need to add a new repo /etc/apt/sources.list.d/upmpdcli.list
deb http://www.lesbonscomptes.com/upmpdcli/downloads/raspbian/ buster main
deb-src http://www.lesbonscomptes.com/upmpdcli/downloads/raspbian/ buster main
$ sudo apt-get update
$ sudo apt-get install upmpdcli
Then all you need to do is edit the following lines in /etc/upmpdcli.conf
mpdhost = localhost
mpdport = 6600
and restart. No need to configure any audio output like with gmediarenderer since MPD will take care of everything.
$ sudo systemctl enable upmpdcli
$ sudo systemctl restart upmpdcli
Client
On my Phone I installed (and paid for premium version of) BubbleUPNP.
I can choose which media server to navigate (phone, NAS or any new DLNA library poping up on network) and on which device to play (Phone, Pi, TV…).