DLNA is a standard for sharing digital media. It is supported by most modern TVs, phones and other devices. So, if you have a Raspberry Pi file server, you can easily use it to stream media. To achieve that, we will install MiniDLNA. This guide assumes you are using Raspbian 9, but the commands should be similar on different flavors of Linux.
Install MiniDLNA and configure it
The installation itself is very straightforward, as it consists of one command:
$ sudo apt install minidlna
After that, you need to configure MiniDLNA at
/etc/minidlna.conf. You should change to following lines:
media_dir=V,/media/external/videos media_dir=A,/media/external/music media_dir=P,/media/external/pictures merge_media_dirs=yes friendly_name=My Media inotify=yes
I think, that most of the options are self- explanatory. The only exception being inotify - it means that MiniDLNA will check for new files periodically. So, you don’t have to do it yourself. In the above settings, I assumed you have your media in several
/media/external/ directories. Whatever directories you use, you have to make sure, that their contents are readable by MiniDLNA. Therefore, they have to be readable by
minidlna user. One way, is to add it to the
$ sudo adduser minidlna pi
Lastly, you need to scan the media collection:
$ minidlna -R $ sudo systemctl restart minidlna
Now, you can stream media to your TV, bluetooth speakers etc. But be careful, not all devices may accept all file formats. And if you need more advanced file manipulation, there is always Samba.