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:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

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

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

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

  2. @MrT
    It will allow me to browse for the subtitle, but when I (manually) select it, it ends with an HTTP 404 error:

  3. 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?

  4. @Martin
    I don’t know storage benchmarks work with DLNA because AFAIK it’s sending HTTP packets.
    You can easily test it by playing videos with different bitrates from SAMBA and DLNA, and see if buffering decrease.
    As mentioned in the introduction, NFS is also another alternative to SAMBA, which should also be faster.

  5. @cnxsoft
    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!

  6. @cnxsoft
    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).

  7. 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 🙂

  8. 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..

  9. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Boardcon Rockchip and Allwinner SoM and SBC products
Boardcon Rockchip and Allwinner SoM and SBC products