Tuesday, December 4, 2012

Setting up MiniDLNA on Ubuntu

I've been wanting for some time now to setup a DLNA server on my primary desktop computer (running Ubuntu Linux) so that the songs and videos stored there would be available to all of the other devices in our home, including the blu-ray player in our entertainment center.  When I finally got around to doing it, it took only a few minutes.  I wish I'd done it sooner!

The simplest way to do this on Linux seems to be the MiniDLNA package.  It's available from the standard repositories on Ubuntu (I'm running 12.04 at the moment).  Use your favorite graphical package manager, or type:

apt-get install minidlna

from a root prompt.  Once installed, you'll need to change a few of the configuration options in the standard configuration file, "/etc/minidlna.conf".

First and foremost, you'll need to tell MiniDLNA where to find the media you wish to share.  This is done using the "media_dir" directive.  Rather than making a system service point to each individual directory in my personal home directory (which occasionally move), I chose to create a new folder named "/usr/local/dlna" and, within that, create symlinks to the folders that store my music & videos:

# tree /usr/local/dlna
├── Music -> /home/bvh/Music/mp3
└── Videos -> /home/bvh/Videos

My minidlna.conf file now needs to contain only a single media_dir directive:


Also in the config file, I changed the name of my server and the serial number presented, just to make it clear which server was mine in case another one ever shows up on a transient device.

The final thing I edited in the config file was the list of filenames that represent album art.  The default list included most of the names used in my collection, but not all of them.  I added a few to the list, and then renamed many of the one-off files to match one of the expected filenames.  The names in bold were added by me:


Finally, it was pointed out that Ubuntu's stock install has the MiniDLNA server starting far too early in the init.d process (step 20).  Depending on where your media lies, you might need to wait until things like remote-mounted drives have been setup.  Since nothing else depends on MiniDLNA, it's best to start it last and stop it first.  Use the following commands (as root) to change this:

update-rc.d -f minidlna remove
update-rc.d minidlna defaults 99 01

Once you have everything configured, shut down MiniDLNA and then force it to reload its media database from the current location, just in case it hasn't refreshed it yet:

service minidlna stop
minidlna -R

All of the clients I tried just magically found the new server, which was a pleasant surprise.  I'm not used to changes going so smoothly.  On a Windows 7 laptop, I used Windows Media Player to play both audio and video.

On our Android mobile devices, I had to install "MediaHouse UPnP / DLNA Browser," as none of the pre-installed apps I tried would speak DLNA.

On our Sony BDP-S370 Blu-ray player, we had some confusion.  Sony uses a cross-bar user interface that allows you to select Video, Music, and Photo sources.  The DLNA server shows up under all three sources.  Under each category, you'll be able to see every file on the DLNA server, but you'll only be able to play the files of the appropriate type.  For example, when you're under the Video drop-down, you'll only be able to play video files.  If you try to play an MP3 while under the Video drop-down, you'll get the error message, "There is no playable file."  If you want to listen to music, you'll have to drill down from the Music drop-down.

My family is already excited to suddenly be able to access our huge collection of videos and music on demand from any device in the house.  What used to be nearly wasted disk space has suddenly become usable again.  If you've got any questions or comments about this, please speak up in the comments below.

No comments:

Post a Comment

Please leave your comment below. Comments are moderated, so don't be alarmed if your note doesn't appear immediately. Also, please don't use my blog to advertise your own web site unless it's related to the discussion at hand.