Setup a DLNA media server attachment
Last update
2019-03-18
2019
03-18
« — »

Install miniDLNA media server:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
sudo apt-get install build-essential autoconf autopoint gettext \
  libavutil-dev libavformat-dev libavcodec-dev libexif-dev \
  libogg-dev libflac-dev libid3tag0-dev libjpeg-dev \
  libsqlite3-dev libvorbis-dev
# or, if you have a src line in /etc/apt/sources.list:
apt-get build-dep minidlna

# download sources
wget -q -O - "https://downloads.sourceforge.net/..." | tar -xzvf -
cd minidlna-*

# compile and install
./autogen.sh
./configure --prefix=/opt/minidlna --with-log-path=/mnt/ramd/dlna_log --with-db-path=/mnt/ramd/dlna_db
make -j 4
make install
cp minidlna.conf /opt/minidlna/

# configure and run server
cd /opt/minidlna
nano minidlna.conf # change user, media_dir and friendly_name
./sbin/minidlnad -f minidlna.conf -P minidlna.pid -d -v [-R]

elinks http://localhost:8200/ # test results

Optionals

  • There is a problem with Samsung F-series TV not showing video thumbnails, you can fix it with the attached minidlna-1.2.1_samsung_f.patch:
1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/upnpsoap.c b/upnpsoap.c
index 441da98..2071317 100644
--- a/upnpsoap.c
+++ b/upnpsoap.c
@@ -1123,7 +1123,7 @@ callback(void *args, int argc, char **argv, char **azColName)
        {
            /* Video and audio album art is handled differently */
            if( *mime == 'v' && (passed_args->filter & FILTER_RES) && !(passed_args->flags & FLAG_MS_PFS) ) {
-               ret = strcatf(str, "<res protocolInfo=\"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN\">"
+               ret = strcatf(str, "<res protocolInfo=\"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM\">"
                                   "http://%s:%d/AlbumArt/%s-%s.jpg"
                                   "</res>",
                                   lan_addr[passed_args->iface].str, runtime_vars.port, album_art, detailID);
  • If you want to use filenames for video files instead of their metadata you can use the attached minidlna-1.2.1_use_video_fname.patch:
1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/metadata.c b/metadata.c
index 8a10c77..48c2f37 100644
--- a/metadata.c
+++ b/metadata.c
@@ -1533,7 +1533,7 @@ video_no_dlna:
                strftime(m.date, 20, "%FT%T", modtime);
        }

-       if( !m.title )
+       //if( !m.title )
        {
                m.title = strdup(name);
                strip_ext(m.title);
1
2
3
4
5
{sm: 48, lrg: 120}.each{|fmt, size| %w{png jpeg}.each {|ext|
  `convert icon.png -scale #{size}x#{size}\! #{size}.#{ext}`
  cpp_out = File.read("#{size}.#{ext}").each_byte.map{|b| '\x'+b.to_s(16) }.join
  File.open("icons.c",'a'){|f| f.puts %Q|unsigned char #{ext}_#{fmt}[] = "#{cpp_out}";| }
} }

Note: Video cover file names must be in the format filename.ext.cover.jpg, audio folders can contain a cover.jpg file.