How-to Setup a DLNA/UPnP Server in Linux for Smoother Video Streaming with Kodi and Other Media Players

I’m normally playing videos from a SAMBA share installed in a Ubuntu PC to play files from Kodi in Android TV box reviews, but sometimes when I use 10/100 Ethernet, or worse WiFi local “streaming” may not be as smooth as possible. SAMBA is convenient because of access control and read write operations, but if you want to get a bit more performance, you may switch to NFS instead, or like I’ve going to show you here to a DLNA / UPnP server to stream videos locally from Kodi 16.1.

There are several options, but MiniDLNA is lightweight compared to MediaTomb, so it will also run on lower end hardware like cheap ARM Linux development boards like Raspberry Pi, Orange Pi, or NanoPi NEO without taking too many resources.

Installation is very easy in Debian / Ubuntu distributions, and I supposed this should also work with Windows Subsystem for Linux in Windows 10:


MiniDLNA can be configured with the same settings for all users, or different settings for specific users. In both case you’ll need to edit /etc/minidlna.conf configuration file. In my case, I only changed or uncommented the following lines for global settings:


You can add as many media_dir lines as you want, and also add A, V or P letter to separate Audio, Video, and Photo media type. For example:


Please note that minidlna daemon (minidlnad) will automatically scan subdirectories, so they don’t need to be specified.

Now that we have modifed the configuration, let’s restart it:


The Wiki on Ubuntu linked in the introduction also mentions to run the following command to rebuild the database:


However, while I could find my new UPnP server in Kodi, there were no files at all, and the log shows the same error message over and over:


eventually the command:


fixed the issue. But that’s not exactly the right way to fix it as it assumes root is running the daemon.

A better way if you’re going to have a decidated server is probably to set the ownership of media files to minidlna with a command like:


So how do you play videos from your DLNA/UPnP server in Kodi 16.1? Go to Videos->Files, and select Add videos…

Kodi_UPnP_devicesNow select UPnP devices

Kodi_miniDLNA_serverKodi should like your UPnP / DLNA servers. In my case FX8350:root, which correspond to the hostname or friendly_name in the hostname, and to the user, normally minidlna. Select the server, than Browser Folder, or Videos, and click OK.

I’ve shot a short video showing how to setup UPnP devices in Kodi, and compare SAMBA and DLNA performance by playing the same video file in Kodi 16.1 Android through SAMBA and UPnP/DLNA.

You’ll notice the video played from the SAMBA server starts much faster, but buffers several time during playback, while the video played from MiniDLNA server on the same PC will buffer data longer at start, and always fill the buffer fast enough to avoid bufferring.

I took Conky screenshots for another video showing the traffic shape for both SAMBA with relatively constant speed (6600 KB/s to 7400 KB/s) and DLNA which shows very high bitrate (>10000 KB/s) to fill the buffer the first time, and then play consistently around 6400 to 6800 KB/s.

SAMBA_vs_DLNA-UPNP

Of course switching from SAMBA to DLNA won’t do miracles, but if you notice a few buffering while playing videos in SAMBA, switching to DLNA/UPnP may resolve the issue. You can also keep the best of both world, for example using SAMBA to download/copy files, and DLNA to play them back.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
11 Comments
oldest
newest
MrT
MrT
8 years ago

My only complaint about using UPNP is that external subtitles are not loaded, something that with SMB share seems to work.

Martin
Martin
8 years ago

I have seen that accessing my Synology NAS with Samba from Ubuntu is very slow.
You think DLNA is faster? This is an interesting idea, is there a benchmark program to test this?

Demetris
Demetris
8 years ago


It’s not after some fiddling with all protocol’s samba is the best and the most compatible for all major OSes
It needs some fine tuning although but after that nothing beats it hands down!

Martin
Martin
8 years ago


I did the following:
samba: cp /mnt/diskstation/video/bigmovie.avi /dev/null ==> 33 seconds

dlna (djmount): cp /mnt/dlna/DiskStation/Video/bigmovie.avi /dev/null ==> 88 seconds

but maybe djmount is not good (it mounts DLNA as file system).

Errepunto
Errepunto
8 years ago

I have been using Plex for a while, using its DLNA server, and works like a charm. Even when my server was a ODROID-U2 🙂

divide
divide
7 years ago

Your most likely seeing that spike in speed because the file is already being cached in memory when you do the test. its pulling that data faster because it doesn’t have to buffer it into memory before the transfer..

Andrey
Andrey
6 years ago

Do you know if it is possible to make minidlna (or use another program) to put the files in folders?
Windows’s media player has a DLNA server built in and when I access it from somewhere else the files would appear as they are in their folders, but minidlna puts them all in a single folder and I can’t distinguish between files with different names.

Anonymous W
Anonymous W
6 years ago

Thanks a lot. Works pefectly for me.

Boardcon Rockchip and Allwinner SoM and SBC products