Musings of a Programmer

Rarely-used blog of Dan Harper.
View all blog posts

Raspberry Pi 2, MiniDLNA

February 26, 2015

  1. Installing Raspbian
  2. Auto-Mounting USB Drives
  3. Transmission
  4. SickBeard
  5. CouchPotato
  6. MiniDLNA
  7. Samba

DLNA allows you to share media content across the network. It can be consumed by many media devices, including my TV :)

Let's install it:

sudo apt-get install minidlna

Now edit the config:

sudo vim /etc/minidlna.conf

You'll see an existing line for media_dir, which is where you can configure shared directories. If a directory contains only one type of content (Music/Pictures/Video), you can prefix the path name with M,, P, or V, respectively. Otherwise, don't include the prefix. Here I'm shared two directories containing video:

media_dir=V,/mnt/usbel/Video

You can include as many of these lines as you like. And the V,-style prefix is optional.

Note If you list your directories individually (e.g. TV, then Movies, then Comedy etc.), DLNA will display them all grouped together. It is instead best to place all video content in a "Video" directory (with TV/Movies/Comedy sub-directories) and share the top-level directory.

Further down, you can configure root_container which adjusts the "top level" view presented to connecting clients. By default this is set to . as a general list of them all. However seeing as I'm only serving up video, I'll set it to V just to save that one step of navigation:

root_container=V

If you'd like to set a custom name for your device, you can use friendly_name. The default falls back to the name of your machine, raspberrypi in my case.

Lastly, you'll want to enable inotify which allows MiniDLNA to automatically add/remove media listings as files are changed in the shared directories:

inotify=yes

Now, seeing as we've modified the media directories, MiniDLNA needs to re-scan, we can do this with:

sudo service minidlna force-restart

If the future you can use restart instead of force-restart to not force a database rebuild if you haven't changed the shared dirs.

Also to note, MiniDLNA runs a really basic web server listing the number of listed Music/Picture/Video files. You can access this on port 8200. Finally, logs are stored at /var/log/minidlna.log.

minidlna.conf docs, source