DLNA media server on Cubieboard with Lubuntu

DLNA media server on Cubieboard with Lubuntu

I have installed Lubuntu on my new Cubieboard 2. I have also attached HDD to SATA so I have more space to store my media. This posts describes the steps needed to install and configure media server to share my media to other devices (media players). I spent some time to select the right one and chose minidlna tool (also known as ReadyMedia, lightweight DLNA/UPnP-AV server targeted at embedded systems).

According to Ubuntu documentation the MiniDNLA daemon serves media files (music, pictures, and video) to clients on a network. Example clients include applications such as totem and xbmc, and devices such as portable media players, smartphones, and televisions.
MiniDLNA is a simple, lightweight alternative to MediaTomb, but has fewer features. It does not have a web interface for administration and must be configured by editing a text file.

Minidlna Installation

Update: MiniDLNA is missing in standard repositories from Ubuntu 14.10. There is open bug to it and as of 2014-02-14 it is still missing in ARMHF packages!
Three installation of minidlna are covered here:

  • Install minidlna for Ubuntu 12.10 (via standard apt-get)
  • Install minidlna for Ubuntu 14.10 ARM (via debian repositories for ARMHF)
  • Install minidlna for Ubuntu 14.10 64bit (via ubuntu repositories)

Try standard package installation first. You can check if the minidlna is present in repositories by:

sudo apt-cache search minidlna

Install minidlna for Ubuntu 12.10 (via standard apt-get)

sudo apt-get update
sudo apt-get install minidlna

Install minidlna for Ubuntu 14.10 ARM (via debian repositories for ARMHF)

wget http://ftp.debian.org/debian/pool/main/m/minidlna/minidlna_1.0.24+dfsg-1_armhf.deb
wget http://ftp.debian.org/debian/pool/main/liba/libav/libavutil51_0.8.17-1_armhf.deb
wget http://ftp.debian.org/debian/pool/main/d/dirac/libdirac-encoder0_1.0.2-6_armhf.deb
wget http://ftp.debian.org/debian/pool/main/libg/libgsm/libgsm1_1.0.13-4_armhf.deb
wget http://ftp.debian.org/debian/pool/main/l/lame/libmp3lame0_3.99.5+repack1-3+deb7u1_armhf.deb
wget http://ftp.debian.org/debian/pool/main/o/openjpeg/libopenjpeg2_1.3+dfsg-4.8_armhf.deb
wget http://ftp.debian.org/debian/pool/main/o/orc/liborc-0.4-0_0.4.16-2_armhf.deb
wget http://ftp.debian.org/debian/pool/main/s/schroedinger/libschroedinger-1.0-0_1.0.11-2_armhf.deb
wget http://ftp.debian.org/debian/pool/main/s/speex/libspeex1_1.2~rc1-7_armhf.deb
wget http://ftp.debian.org/debian/pool/main/libo/libogg/libogg0_1.3.0-4_armhf.deb
wget http://ftp.debian.org/debian/pool/main/libt/libtheora/libtheora0_1.1.1+dfsg.1-3.1_armhf.deb
wget http://ftp.debian.org/debian/pool/main/libv/libva/libva1_1.0.15-4_armhf.deb
wget http://ftp.debian.org/debian/pool/main/libv/libvorbis/libvorbis0a_1.3.2-1.3_armhf.deb
wget http://ftp.debian.org/debian/pool/main/libv/libvorbis/libvorbisenc2_1.3.2-1.3_armhf.deb
wget http://ftp.debian.org/debian/pool/main/libv/libvpx/libvpx1_1.1.0-1_armhf.deb
wget http://ftp.debian.org/debian/pool/main/x/x264/libx264-123_0.123.2189+git35cf912-1_armhf.deb
wget http://ftp.debian.org/debian/pool/main/x/xvidcore/libxvidcore4_1.3.2-9_armhf.deb
wget http://ftp.debian.org/debian/pool/main/liba/libav/libavcodec53_0.8.17-1_armhf.deb
wget http://ftp.debian.org/debian/pool/main/liba/libav/libavformat53_0.8.17-1_armhf.deb
wget http://ftp.debian.org/debian/pool/main/f/flac/libflac8_1.2.1-6+deb7u1_armhf.deb

sudo dpkg -i libavutil51_0.8.17-1_armhf.deb
sudo dpkg -i libdirac-encoder0_1.0.2-6_armhf.deb
sudo dpkg -i libgsm1_1.0.13-4_armhf.deb
sudo dpkg -i libmp3lame0_3.99.5+repack1-3+deb7u1_armhf.deb
sudo dpkg -i libopenjpeg2_1.3+dfsg-4.8_armhf.deb
sudo dpkg -i liborc-0.4-0_0.4.16-2_armhf.deb
sudo dpkg -i libschroedinger-1.0-0_1.0.11-2_armhf.deb
sudo dpkg -i libspeex1_1.2~rc1-7_armhf.deb
sudo dpkg -i libogg0_1.3.0-4_armhf.deb
sudo dpkg -i libtheora0_1.1.1+dfsg.1-3.1_armhf.deb
sudo dpkg -i libva1_1.0.15-4_armhf.deb
sudo dpkg -i libvorbis0a_1.3.2-1.3_armhf.deb
sudo dpkg -i libvorbisenc2_1.3.2-1.3_armhf.deb
sudo dpkg -i libvpx1_1.1.0-1_armhf.deb
sudo dpkg -i libx264-123_0.123.2189+git35cf912-1_armhf.deb
sudo dpkg -i libxvidcore4_1.3.2-9_armhf.deb
sudo dpkg -i libavcodec53_0.8.17-1_armhf.deb
sudo dpkg -i libavformat53_0.8.17-1_armhf.deb
sudo dpkg -i libflac8_1.2.1-6+deb7u1_armhf.deb
sudo dpkg -i minidlna_1.0.24+dfsg-1_armhf.deb

If during the installation you will be noticed with message e.g. Package libvpx1:armhf is not installed. then search the package in debian packages for armhf and donwload and install them one by one (the order is important).

Install minidlna for Ubuntu 14.10 64bit (via ubuntu repositories)

This is based on ubuntu forum help.

  wget http://dk.archive.ubuntu.com/ubuntu/pool/universe/m/minidlna/minidlna_1.0.21+dfsg-1ubuntu1_amd64.deb
  wget http://security.ubuntu.com/ubuntu/pool/main/liba/libav/libavformat53_0.8.10-0ubuntu0.12.04.1_amd64.deb
  wget http://security.ubuntu.com/ubuntu/pool/main/liba/libav/libavcodec53_0.8.10-0ubuntu0.12.04.1_amd64.deb
  wget http://security.ubuntu.com/ubuntu/pool/main/liba/libav/libavutil51_0.8.10-0ubuntu0.12.04.1_amd64.deb

  dpkg -i libavutil51_0.8.10-0ubuntu0.12.04.1_amd64.deb
  dpkg -i libavcodec53_0.8.10-0ubuntu0.12.04.1_amd64.deb
  dpkg -i libavformat53_0.8.10-0ubuntu0.12.04.1_amd64.deb
  dpkg -i minidlna_1.0.21+dfsg-1ubuntu1_amd64.deb

Minidlna Configuration

Finally, I have minidlna version 1.0.24:

minidlna -V
Version 1.0.24

My media are stored in a folder  /media/disk/Movies/ (guide to attached HDD to SATA) with the following access rights:

ll /media/disk/ | grep Movies
drwxr-xr-x 3 linaro root  4096 May 25 21:35 Movies/
So I have to add this to minidlna.conf file.
sudo mcedit /etc/minidlna.conf

The how-to configure minidlna is directly commented in the configuration file. The most important part for locating the media:

# If you want to restrict a media_dir to a specific content type, you can
# prepend the directory name with a letter representing the type (A, P or V),
# followed by a comma, as so:
#   * "A" for audio    (eg. media_dir=A,/var/lib/minidlna/music)
#   * "P" for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)
#   * "V" for video    (eg. media_dir=V,/var/lib/minidlna/videos)
#
# WARNING: After changing this option, you need to rebuild the database. Either
#          run minidlna with the '-R' option, or delete the 'files.db' file
#          from the db_dir directory (see below).
#          On Debian, you can run, as root, 'service minidlna force-reload' instead.

The list of all my not commented lines that worked for me:

media_dir=V,/media/disk/Movies
db_dir=/var/lib/minidlna                            # Needs to be un-commented
log_dir=/var/log                                          # Needs to be un-commented
port=8200                                                     # http port to check minidlna status
friendly_name=Doma DLNA
serial=12345678
model_number=1
inotify=yes                                                  # 'no' for less resources, restart required for new media
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
strict_dlna=no
enable_tivo=no
notify_interval=895
Check the status and restart minidlna with forcing to reload media list:
sudo service minidlna status
sudo service minidlna force-reload

Look at log to see if dlna restarted. It scanned our media folder that we configured in 32 seconds.

cat /var/log/minidlna.log
[2014/06/01 17:18:33] minidlna.c:155: warn: received signal 15, good-bye
[2014/06/01 17:18:34] minidlna.c:898: warn: Starting MiniDLNA version 1.0.24 [SQLite 3.7.13].
[2014/06/01 17:18:34] minidlna.c:926: warn: Creating new database...
[2014/06/01 17:18:34] minidlna.c:1006: warn: HTTP listening on port 8200
[2014/06/01 17:18:34] scanner.c:727: warn: Scanning /media/disk/Movies
[2014/06/01 17:19:06] scanner.c:798: warn: Scanning /media/disk/Movies finished (219 files)!
[2014/06/01 17:19:06] playlist.c:125: warn: Parsing playlists...

Since we also opened http connection, you can check the status of minidlna scanned files by going to its IP address and port 8200:

Now I will try my LG home theater that is DLNA client certified and I’m able to select my new media server as I’ve configured – Doma DLNA. Minidlna in Ubuntu uses Debian logo:

My home media player shows my DLNA server logo so it looks that everything works

 

In android devices I use BubbleUPnP application to play my media:

We are done. 😉

Other notes

To run minidlna from terminal and have the PID stored in minidlna.pid file with media scan refresh (not needed it you sudo service minidlna force-reload):

sudo minidlna -P /home/$USER/minidlna.pid -R

Another guide for the same topic on Ubuntu server.

Firewall Rules

If using a firewall the the ssdp (1900/udp) and trivnet1 (8200/tcp) ports will need to be opened. For example this can be done with arno’s iptables firewall by editing firewall.conf to:

OPEN_TCP="8200"
OPEN_UDP="1900"