Saturday, July 2, 2016

Raspberry Pi – Media Server for Streaming (via DLNA)

 

Here I’m going to quickly show you how to set up you Raspberry Pi as a Media Server for Streaming via DLNA which is a protocol suported in many TVs, Windows PCs (Windows Media Player) and Android Devices (App: Media House).

## Install Mini DLNA ##
sudo apt-get update
sudo apt-get install minidlna

## Mount The Media Disk ##
sudo mkdir /media/HD1
sudo mount /dev/sda1 /media/HD1

## Create The MiniDLNA DB Folder ##
sudo mkdir -p /opt/minidlna
sudo chmod 777 /opt/minidlna

## Edit The MiniDLNA Config File ##
sudo nano /etc/minidlan.conf

minidlna.conf - My Config
------------------------------------
media_dir=V,/media/HD1/Movies
#root_container=B,/media/HD1
network_interface=eth0
inotify=yes
friendly_name=HomePi
db_dir=/opt/minidlna

sudo service minidlna force-reload
sudo service minidlna restart


minidlna.conf – My Config Detailed
-------------------------------------------------------
#################################################
# Path to the directory you want scanned
# for media files.
#
# This option can be specified more than
# once if you want multiple directories
# scanned.
#
# 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,/media/HD1/music)
#   * "P" for pictures (eg. media_dir=P,/media/HD1/pictures)
#   * "V" for video    (eg. media_dir=V,/media/HD1/videos)
#   * "PV" for pictures and video
#  (eg. media_dir=PV,/media/HD1/digital_camera)
#################################################
media_dir=V,/media/HD1/Movies
NOTE: Use media_dir or root_container

#################################################
# Use a different container as the root
# of the directory tree presented to
# clients.
#
# The possible values are:
#   * "." - standard container
#   * "B" - "Browse Directory"
#   * "M" - "Music"
#   * "P" - "Pictures"
#   * "V" - "Video"
#   * Or, you can specify the ObjectID
#     of your desired root container
#     (eg. 1$F for Music/Playlists)
#
# If you specify "B" and the client
# device is audio-only then "Music/Folders"
# will be used as root.
###########################################
#root_container=B,/media/HD1

#################################################
# Network interface(s) to bind to
#(e.g. eth0), comma delimited.
#
# This option can be specified more than once.
#################################################
network_interface=eth0

#################################################
# Automatic discovery of new files
# in the media_dir directory.
#################################################
inotify=yes

#################################################
# Name that the DLNA server presents to clients.
# Defaults to "hostname: username".
#################################################
friendly_name=HomePi

#################################################
# Path to the directory that should
# hold the database and album art cache
#################################################
db_dir=/opt/minidlna
 
 
Now from you TV or other media device, like Android (use MediaHouse) you can stream
or download you media, with no config required on the clients, because these automatically
detect the DLNA server on the LAN.

Related Links

No comments: