After my most recent disappointment when I tried to feed my tv with a media stream from my NAS (which didn’t work because the NAS isn’t DLNA certified), I took a closer look today at getting this to work in general by whatever means. Hence, I decided to set up a media server on my main machine (which is kind of stupid in a way, because if it works then I would no longer require my NAS).
I’ve tried several solutions.
First one: uShare
Installation and configuration was super easy and took about five minutes. Problem was that the media server didn’t show up anywhere – not on my tv, not on my mobile, not even on the machine that runs the service.
Second one: Plex
Again, installation and configuration was super easy. Took a bit longer though because of the software’s complexity. Showing up on all devices immediately. But: no files! Turns out that you need to register and connect to myplex.something. Mmh, not sure I like sharing my drive contents over the internet this way. No no, I’d rather keep that door closed.
Third (and so far final) one: miniDLNA
Third time, installation and configuration super easy. Shows up immediately on all devices. But again: no files. In this case, it was simply an issue with file permissions though. Let me explain what needs to be done in order for the thing to work as expected.
Ubuntu repo ships with miniDLNA, so installation can be done using the Software Center.
There are two configuration files that require adjustment:
# Defaults for minidlna initscript
# sourced by /etc/init.d/minidlna
# installed at /etc/default/minidlna by the maintainer scripts
# These options can be set to modify the behavior of the minidlna init script.
# The options commented out show the default values.
# Start the daemon if set to “yes”
# Path to the configuration file
# Path to the log file
# User and group the daemon should run as
# Additional options that are passed to the daemon
The yellow-marked lines were the only ones I had to update. Before doing so, the daemon would not be granted access to my media directories.
# This is the configuration file for the MiniDLNA daemon, a DLNA/UPnP-AV media
# Unless otherwise noted, the commented out options show their default value.
# On Debian, you can also refer to the minidlna.conf(5) man page for
# documentation about this file.
# Path to the directory you want scanned for media files.
# This option can be specified more than once if you want multiple directories
# If you want to restrict a media_dir to a specific content type, you can
# prepend the directory name with a letter representing the type (A, P or V),
# followed by a comma, as so:
# * “A” for audio (eg. media_dir=A,/var/lib/minidlna/music)
# * “P” for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)
# * “V” for video (eg. media_dir=V,/var/lib/minidlna/videos)
# WARNING: After changing this option, you need to rebuild the database. Either
# run minidlna with the ‘-R’ option, or delete the ‘files.db’ file
# from the db_dir directory (see below).
# On Debian, you can run, as root, ‘service minidlna force-reload’ instead.
# Path to the directory that should hold the database and album art cache.
# Path to the directory that should hold the log file.
# Minimum level of importance of messages to be logged.
# Must be one of “off”, “fatal”, “error”, “warn”, “info” or “debug”.
# “off” turns of logging entirely, “fatal” is the highest level of importance
# and “debug” the lowest.
# Use a different container as the root of the directory tree presented to
# clients. The possible values are:
# * “.” – standard container
# * “B” – “Browse Directory”
# * “M” – “Music”
# * “P” – “Pictures”
# * “V” – “Video”
# if you specify “B” and client device is audio-only then “Music/Folders” will be used as root
# Network interface(s) to bind to (e.g. eth0), comma delimited.
# IPv4 address to listen on (e.g. 192.0.2.1).
# Port number for HTTP traffic (descriptions, SOAP, media transfer).
# URL presented to clients.
# The default is the IP address of the server on port 80.
# Name that the DLNA server presents to clients.
friendly_name=Name of the server to be communicated in the LAN
# Serial number the server reports to clients.
# Model name the server reports to clients.
#model_name=Windows Media Connect compatible (MiniDLNA)
# Model number the server reports to clients.
# Automatic discovery of new files in the media_dir directory.
# List of file names to look for when searching for album art. Names should be
# delimited with a forward slash (“/”).
# Strictly adhere to DLNA standards.
# This allows server-side downscaling of very large JPEG images, which may
# decrease JPEG serving performance on (at least) Sony DLNA products.
# Support for streaming .jpg and .mp3 files to a TiVo supporting HMO.
# Notify interval, in seconds.
# Path to the MiniSSDPd socket, for MiniSSDPd support.
Again, yellow-marked lines indicate changes. Regarding the network interface and the serial number, I’m not even sure if those adjustments are required.
inotify=yes simply tells the daemon to check for database updates automatically.
That’s basically it. Now, before starting the service, you may want to have it scan your directories and create the necessary db file. The following command takes care of that:
sudo minidlna -R
Do not connect to the media server while it is scanning, because it’ll interrupt the scan process. Unfortunately, miniDLNA is not very verbose when it comes to status information (more precisely, it’s generally not very verbose). You can check the status of your scan by referring to localhost:8200. Once the scan is complete, simply power up the service:
sudo service minidlna start
Of course, you can stop the service by typing:
sudo service minidlna stop
There was one more thing that was bugging me. Having set up everything, I found that when browsing the media repo the client has only three categories:
That’s not very handy when dealing with thousands of files. It’s not a big deal for me when it comes to music, because in my music folder there are subfolders according to music genre which categorize files further. And that’ll also be reflected when connecting to the server. For movies, however, it was annoying, because so far my only distinction would be between
- SD movies
- HD movies
- Movies from a guy called Markus^^
Sounds odd but is enough for me right now as categorization. What happened is that when I specified the different folders in the conf file, the client would show the contents of those folders in one single view.
Create a new directory; let’s call it myDLNAShares. Within that directory, create symbolic links to the various media folders. Finally, instead of defining half a dozen paths in the config, just have one single entry:
That sorts the problem.
Even though I’m not sure I really need it, my media server is now up and running and all just works like a charm:).