DLNA

Raspberry Pi Setup – Part 3 – Media Server

In Part 2 we shared files using a Samba server. Now a more advanced way to share media (video, music, pictures) is to use a media server.

A Raspberry Pi can make for a great Media Centre experience. Most modern smart TVs can automatically detect a media server on your network. The go to media server app is ReadyMedia (formally known as miniDLNA). It runs light on resources and gives enough functionality to sort and share your media files.

Install ReadyMedia

  1. Connect to your pi over terminal/cmd
    ssh pi@192.168.1.20
  2. Install ReadyMediasudo apt-get update
    sudo apt-get upgrade

    sudo apt-get install minidlna

Choose a Folder to Share

  1. Any directory can be created and shared.
    1. Option 1 – Continue sharing the folder you created in Part 1.
    2. Option 2 – Create a new folder with the proper permissions using the command
      sudo mkdir -m 1777 <directory>
      Ex sudo mkdir -m 1777 /media/myusbdriveshare/videos
  2. Create other folders as needed
    Ex.
    sudo mkdir -m 1777 /media/myusbdriveshare/audio
    sudo mkdir -m 1777 /media/myusbdriveshare/pictures
  3. If the folder already exists, just set the permissions
    sudo chmod 1777 /media/myusbdriveshare/videos

Configure the Media Server

  1. Open the Configuration file
    sudo nano /etc/minidlna.conf
  2. Quick note on the basic settings:
    friendly_name – you can change the name of your DLNA servicemedia_dir the type of files and what directory you want to share ex.

    Now to make our changes:

    friendly_name=RASPI

media_dir=V,/media/myusbshare/videos

media_dir=A,/media/myusbshare/audio

media_dir=P,/media/myusbshare/pictures

Restart the Service

sudo service minidlna restart

Force a refresh its contents or skip this step and wait for the automatic update

sudo service minidlna force-reload

Troubleshooting

Note that the cache can be found here. If you ever have trouble with stale or old information shared about your library, simply delete this file and restart.

/var/cache/minidlna/files.db