Listen to your music and play video from your RaspberryPi NAS using DLNA

Note: DLNA will give access to your files on RaspberryPi through your local wireless network. Be careful choosing directories to expose.

Supposing you’ve already a RaspberryPi NAS:

sudo apt get install minidlna
sudo nano /etc/minidlna.conf

Change media dir to:


where /media/MYDRIVE is the mount point and music is your music directory and A is the flag for Audio (leave unchanged for music, for pictures use P, for video use V).

Change db_dir (preview, database and cache directory) in:


Look for “friendly_name” and change it into something like:


Then Ctrl+O to save.

Create the cache directory (as pi user, not superuser):

mkdir /media/MYDRIVE/cache
mkdir /media/MYDRIVE/cache/minidlna

Then use pi user for minidlna service (read previous howto for details about permissions and external drives).

sudo nano /etc/init.d/minidlna

And add USER=pi under the DEFAULT line:


Then force reload the service, regenerating the cache and db:

sudo service minidlna force-reload

Now indexing is in progress: if you use a DLNA enabled device, like an Android phone (e.g. via DLNA application) or a Samsung Internet TV, you’ll got the list of files growing in number under the rasperrypi:RaspberryPiMusic server.

If you want to add new media directories, you have to add another media_dir to the list, specifying the media flag. I want to add my anime folder:

And then my anime folder:


This time I omit the flag to play all contents, there are some mp3 too there and I want to play those!

Every time you add a new directory to watch, rebuild the database with force-reload, but if you want only to restart service use stop, start and restart instead of force-reload.

For a more detailed howto and the use of BubbleUPnP (shared playlist among devices) read this blog post by Stephen C Phillips, source of many info here.

Note: this post originated from this question by Fanie.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s