DLNA on Raspberry Pi

I always wanted to setup a media server at home for the following reasons:

  1. Reduce redundancy - having multiple copies of media for different devices like phone, tablet, smart TV etc
  2. Ease of use - no need to copy files to and from devices to play media (mostly Floyd and movies)
  3. One stop shop with transmission integration - download files on rpi and they appear on the media server

The easiest solution was to turn my RaspberryPi into a DLNA server. For this I required to a few basic packages and had to configure each.

It was a bit hard to find all of them in a single post and hence I’m writing this post.

Packages required #

samba #

Append /etc/samba/smb.conf

  path = /path/to/public/folder
  browseable = yes
  writeable = yes
  guest ok = no
  read only = no

minidlna #

Edit /etc/minidlna.conf



transmission-daemon #

mkdir -p /opt/torr
sudo chown -R debian-transmission /opt/torr

cp /etc/transmission-daemon/settings.json /etc/transmission-daemon/settings_template.json

Edit /etc/transmission-daemon/settings.json

Change the value of download-dir field to /opt/torr

    "download-dir": "/opt/torr",

Time to test! #

sudo service samba stop
sudo service samba start

sudo service minidlna stop
sudo service minidlna start

sudo service transmission-daemon stop
sudo service transmission-daemon start

To test if transmission daemon is running, open http://rpi_ip_addr:9091/transmission/web/

IP address of devices keep changing and hence it is difficult to access it with IP address.
We can solve this problem by using the .local domain. For this we need avahi-daemon and tweak the hosts file

avahi-daemon #

sudo apt-get install avahi-daemon

Edit /etc/init.d/hostname

Change raspberrypi

to [new name here]

Reboot rpi

Now you should be able to access your raspberrypi using the URL http://host_name.local

For example, http://raspberrypi.local

PS: Most of the times minidlna does not refresh the collection in the specified folders. We need to explicitly run the following command

sudo minidlna -R
sudo service minidlna restart 

This problem might be because of the inotify functionality of the linux kernel. It has to be enabled by the kernel. A solution is posted here

Courtesy #


Now read this

Parsing JSON in Scala

Introduction # I started a side project on Scala with a group of friends (noobs in scala). We chose Scala because it is well known for type safety and functional programming with support for OOP. One of the important parts of the project... Continue →