uPNP server with miniDLNA

http://everbit.wordpress.com/2013/04/01/minidlna-on-the-raspberry-pi/

MiniDLNA

MiniDLNA will allow streaming of video, TV, and pictures from the external hard drive to other devices in your home. Perfect for NZBGet and SickBeard

MiniDLNA

Install and configure MiniDLNA

1
2
sudo apt-get install minidlna
sudo chown minidlna:minidlna /var/lib/minidlna

Create log and cache files for MiniDLNA, edit the conf file and restart.

1
2
sudo mkdir /var/{cache,log}/minidlna
sudo chown minidlna:minidlna /var/{cache,log}/minidlna

Edit the config file

1
2
3
4
5
6
7
8
sudo nano /etc/minidlna.conf
media_dir=V,/media/ExtHD/usenet/tv
db_dir=/var/cache/minidlna
log_dir=/var/log/minidlna
inotify=yes
notify_interval=300
listening_ip=[IP of rPi]

Add this to the end of the /etc/sysctl.conf file to fix some issues

1
2
3
4
sudo nano /etc/sysctl.conf
# minidlna server tweaks
fs.inotify.max_user_watches = 100000
# end of minidlna server tweaks

Give MiniDLNA permissions to view the media_dir. To do this I added the minidlna user to the sbeard group as my media_dir allows the sbeard group to make changes.

1
sudo usermod -a -G sbeard minidlna

Force-reload MiniDLNA

1
2
3
sudo services minidlna stop
sudo service minidlna force-reload
sudo service minidlna start

Your Raspberry Pi will now be able to stream media over your network.

MiniDLNA Problems

I, and others, have had many problems with MiniDLNA not working the way it should. The following are some problems and how I fixed them.

1. MiniDLNA disconnects from my client every 10-30 minutes.

There are 2 fixes I found for this problem. The first is to set your notify_interval level in the minidlna.conf file to a very high number, such as 90000. This solved the issue for me but since the notify interval was so high MiniDLNA wouldn’t search the media_dir for new files in a long time.

The other fix for me was to turn off UPnP on my router. When I turned it off the issue never came back and I set my notify_interval to 300 and there were no more problems.

2. MiniDLNA doesn’t update its files.db with new files that have beed added to the media_dir.

I fixed this one by changing the path of media_dir and creating a link to where my files are. I used the following steps

Stop the minidlna service and delete the art_cache and files.db file

1
2
sudo service minidlna stop
sudo rm -r /var/cache/minidlna/*

Edit minidlna.conf with the path to the new media_dir

1
2
sudo nano /etc/minidlna.conf
media_dir=V,/var/lib/minidlna/videos

create a link in /var/lib/minidlna to your ExtHD

1
sudo ln -s /media/ExtHD/usenet/tv /var/lib/minidlna/videos

Start MiniDLNA and give it time to recreate its Db

1
sudo service minidlna force-reload

3. MiniDLNA doesn’t have permissions to view newly created folders in the watched media_dir
I solved this by running MiniDLNA as the user root instead of minidlna. Edit init.d and add USER=root near the top.

1
2
sudo nano /etc/init.d/minidlna
USER=root

 

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>