How to set up a DLNA server on Ubuntu 14.04?

Solution 1:

The simple way is to use MiniDLNA, because it should be on Ubuntu repositories and it is a simple tool.

You can try all DLNA apps and still your TV is not going to run some file types. You need to check what type of files your capable DLNA TV support.

I recommend you to check the Community Wiki entry on how to configure MiniDLNA or watch an instructional video. Very simple and straight forward.

For MiniDLNA follow these steps:

  1. Install MiniDLNA

    sudo apt-get install minidlna
    
  2. Edit configuration file

    gksu gedit /etc/minidlna.conf
    
  3. Add the following text to the file. Replace the folders name by the ones you use. You can just use one type if you want.

    inotify=yes
    media_dir=P,/home/user/Pictures
    media_dir=V,/home/user/Videos
    media_dir=A,/home/user/Music
    media_dir=/home/user/Videos
    friendly_name=UbuntuDLNA
    
  4. Then restart the service to apply changes

    sudo service minidlna restart
    
  5. Make sure the file list is rebuild

    sudo service minidlna force-reload
    

Solution 2:

Well, how about trying Universal Media Server, a fork of former PMS server, and see how it goes.. comes with a free web interface and a pretty adequate help support as well. Had it in 14.04 64 bit, worked like a charm to like almost 95% of video formats tested to a Panasonic Tv, and 99% to a Samsung.

Solution 3:

Here's a list of the gotchas that I came across and overcame when working with a couple of DLNA servers and clients. Keeping the below list in mind, I no longer have issues viewing my files.

The following affect media visible to clients:

  • FILENAME EXTENSIONS:

The DLNA client should indicate which types of media they support (i.e., read their help menu and/or manual). For example, one player might understand m4v and mp4 extensions (e.g., PlayStation), while another only understands mp4 (Roku), even though the file is encoded the same for either extension. Thus, you might have to change the filename (e.g., to mp4 for Roku) or just create a symbolic-link to the (m4v) file and name the symbolic-link with the correct extension (mp4).

Another example, this time on the audio side, my Roku will play lossless "flac" files, but my PS3 won't and requires "wav", instead.

  • REBOOT SERVER:

I've not needed this for minidlna, but I did have an ASUS router that had a built-in DLNA server. Restarting the service was usually enough, but on occasion I even had to reboot the router, followed by toggle the DLNA service. (This is why I switched to minidlna.)

  • REBOOT CLIENTS:

Some DLNA clients (PlayStation 3) may need rebooting to see the DLNA server and/or changes in media on the server-side. (Yes, weird, but true.)

  • PERMISSIONS:

Ensure path and filename on media server are accessible to server user (e.g., "minidlna"). Just because you enter the path into /etc/minidlna.conf doesn't make it magically work if user "minidlna" cannot traverse the path ALL THE WAY to the files' directory, including ensuring having file-level access.

This means, directories not owned by minidlna but needing to be traversed can be set to NOT allow read/write by others (minidlna) but ALLOW traversing ONLY:

chmod o+x-rw /home/myUserName/

Directories that CAN be browsed by the public (minidlna) are set readable:

chmod o+rx-w /home/myUserName/videos/

And finally, all files/folders are recursively set publically readable inside "videos":

find /home/myUserName/videos/ -type d ! -perm 0775 -exec chmod -v 0775 {} \;
find /home/myUserName/videos/ -type f ! -perm 0444 -exec chmod -v 0444 {} \;
  • CONVERT MEDIA NOT SUPPORTED:

I had a bunch of AVI files (as well as other formats) that my Roku wouldn't display. With "handbrake" I can pretty much convert my media to MP4 files. I also use command-line tool ffmpeg for either video or audio conversions, although ffmpeg doesn't always convert my AVI-to-MP4 files successfully.

  • RESTART SERVICE AND REBUILD DATABASE:

After all is said and done:

sudo service minidlna restart
sudo service minidlna force-reload

NOTE: It also helps to have "inotify=yes" in /etc/minidlna.conf to ensure "Automatic discovery of new files in the media_dir directory."