Setup a DLNA media server attachment
Last update
2017-11-03
2017
11-03
« — »

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

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.

To change the default media server icon you have to modify icons.c source file, use these ruby commands to convert your icon.png file:

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.