Configuring minidlna on Raspberry Pi

I have a couple of raspberry Pis I thought I’d use one as a little media server to stream to my TVs. to do this I settled on minidlna to install it was simple a simple

sudo apt-get install minidlna

However to get it working with the files in my home directory took some time.

To get it to read the files stored in my Videos directory I had to edit /etc/minidlna.conf

and uncomment the line that started media_dir = and change it to

media_dir=/home/andrew/Videos

However minidlna could not read my files as it is running as the user minidlna. Unfortunately changing the user in minidlna.conf resulted in an error regarding the PID file. I will look at this another day to work out why. So in the meantime I added the minidlna user to my user group by typing at the command prompt:

sudo usermod -aG andrew minidlna

Again no files appeared on my TV looking at the log file /var/log/minidlna.log showed there was a problem with inotify max_user_watches not being sufficient.

the value that was set in /proc/sys/fs/inotify/max_user_watches was set to 8192. I changed that to a value I found on another site to 66538 I don’t have that many files stored so this seemed an OK value for me.

I added the line to /etc/sysctl.conf as follows

fs.inotify.max_user_watches = 66538

I used nano to add the line but

sudo echo 'fs.inotify.max_user_watches=66538' >> /etc/sysctl.conf

would also work. After this I rebooted but

sudo sysctl -p /etc/sysctl.conf

would update sysctl without rebooting.

After this I was able to view my videos on my TV.
If you wish to have separate folders for music or photos then you can change minidlna.conf and add extra rows as follows

media_dir=V,/home/andrew/Videos
media_dir=P,/home/andrew/Pictures
media_dir=A,home/andrew/Music

I recommend reading the minidlna.conf file for other configuration options. The only thing I would like to do is change the graphic associated with minidlna when viewed on a TV. It shows the debian swirl it would be nice to change this to something else.

Leave a Reply

Your email address will not be published. Required fields are marked *