Sunday, September 9, 2012

Howto : Linux - Setup a simple and powerful DNLA server (UPnP protocol) in 5 minutes with minidlna




The Goal:

With "minidlna" you will create within a few minutes a real simple but powerful DLNA Server.

UPnP is a protocol (and DLNA a certification based on this protocol) being more and more used by many manufacturers, it allow you to share your multimedia files between all your DLNA compliant devices.

As a simple example, you have a computer acting as your DLNA server and sharing multimedia files through your network to your Home Cinema.

Minidlna is the perfect DNLA server, simple, light and powerful.

Let's begin!



1 - Install minidna


On Ubuntu based systems, just do:

$ sudo apt-get install minidlna


2 - Configure minidlna


Edit main minidlna configuration file "/etc/minidlna.conf" and do same changes as follows:

- Change port to "49200"

- Add your media sources, you can add as many sources as you want like this:
media_dir=V,<MY VIDEO SOURCE 1>
media_dir=V,<MY VIDEO SOURCE 2>
media_dir=A,<MY MUSIC SOURCE>

- uncomment "friendly_name" (delete "#") and set it to the value you want, it will be the displayed name of your DLNA server

- uncomment "log_dir" (delete #) to ensure main log will be available in /var/log

You case also manually setup the location of the database file. (called files.db)

3 - Start minidlna and begin the scan of your library


Minidlna has been started automatically when installed, but we want it to take in charge our modifications and begin to scan our sources.

First, stop minidlna:
$ sudo /etc/init.d/minidlna stop

Delete existing database:
$ sudo rm /var/lib/minidlna/files.db

Start minidlna:
$ sudo /etc/init.d/minidlna start

And finally take a look at the log files to see what is doing minidlna process:
$ tail -20f /var/log/minidlna.log

Depending on number of files in your sources, minidlna will need a few time to scan, you should see a message like this:
[2012/09/08 17:08:25] scanner.c:719: warn: Scanning /media/FREECOM-HDD/Multimedia/Films_HD-DVD
[2012/09/08 17:08:57] scanner.c:790: warn: Scanning /media/FREECOM-HDD/Multimedia/Films_HD-DVD finished (232 files)!


4 - Access to your DLNA device and navigate to your DLNA Server



Depending on your device, go the your menu and navigate into your DLNA server.

Here is one example screenshot using my LG Home Cinema:





And this works very well, i can play a big big mkv in 1024p (around 45 GB size, native Blu-ray) using local Network (my LG Home Cinema has a 100 Mbps local network connection) with absolutely no issues!

Real great!

Keep in mind that this may also depends on your DLNA device capacity...

Finally, with minidlna note a few last more things:

1. In case of trouble, do not hesitate to delete the database file (see steps above) and restart minidlna, it will automatically recreate the database

2. minidlna sometimes does not like specific characters, you should avoid this in your folder names

3. Some file format may not be playable, it depends on your DLNA device and minidlna.
In my experience, prefer a mkv file, almost all recent devices will support mkv

4. Any added media file will be automatically available in minidlna