[TUTO] Install and SetUp minidlna media server


46 posts   Page 1 of 2   1, 2
by Anoflix » Mon Sep 03, 2012 11:51 am
Hi All,
My name is Georges. 24. a French guy interested in RasPi :D :D


I have seen several tutorials about minidlna server but, there was always something missing, so I want to share with you.

The idea is to use the RasPi as a multimedia server (in my case, for my PS3).

Hardware/Network configuration :
RasPi (I an under raspian, I use 2012-08-16-wheezy-raspbian)
External HD, or USB device, where media files are stored. Plug it to RasPi (USB)
PS3 (or any mediacenter to discover to RasPi media files)
(PC, ) RasPi and PS3 under to same sub-network

As I only have 1 screen for PS3 and RasPi, I did the configuration using ssh

[list=]Assuming IP adress table is :
PC : 192.168.0.11
PS3 : 192.168.0.14
RasPi : 192.168.0.16[/list]

In case of using ssh, Connect :
Code: Select all
ssh pi@192.168.0.16


Enter password (default "raspberry"), then tty command line appears
Code: Select all
pi@raspberrypi~:


I recommend updating everything before intallation :
Update package list:
Code: Select all
sudo apt-get update

Update packages:
Code: Select all
sudo apt-get upgrade


Mount hard drive automatically :
Use this command to discover UUID :
Code: Select all
sudo blkid

You see your drive suck as :
Code: Select all
/dev/sda1: LABEL="ExternalHD" UUID="49A1-143B" TYPE="vfat"


Make a directory where to mount the disk and change the autorizations:
Code: Select all
sudo mkdir -p /media/HardDrive
sudo chmod 755 /media/HardDrive


Edit the fstab file :
Code: Select all
sudo nano /etc/fstab


Add this line (using your UUID and TYPE) :
Code: Select all
UUID=49A1-143B  /media/HardDrive   vfat    defaults      0     0


Install minidlna :
Code: Select all
sudo apt-get install minidlna

It will warn you about how many disk space it will use and dependencies installation

Now you can configure minidlna:
Code: Select all
sudo nano /etc/minidlna.conf


You see many options like :
Code: Select all
# Change the Media Dir's to point to the external hard drive, obviously change these to match your directory layout
media_dir=A,/media/HardDrive/Media/Music
media_dir=V,/media/HardDrive/Media/Video
media_dir=P,/media/HardDrive/Media/Photos
 
# Change db_dir so that the database is saved across reboots
db_dir=/home/pi/.minidlna
 
# Uncomment log_dir for now in case we hit problems
log_dir=/var/log


You can choose to start minidlna at boot :
Code: Select all
sudo update-rc.d minidlna defaults

Or just start it once now :
Code: Select all
sudo service minidlna start


MiniDLNA will now begin indexing all of your media files, it's quite quick but folders not COMPLETELY indexed will not appear until they are done.

If you modify minidlna configuration, you have to reload it :
Code: Select all
sudo service minidlna force-reload


You PS3 detects automatically the server in sections Pictures, Music or Videos
Usage is absolutely fluid. Play and pause a DivX without any problem. Thumbnail using square button is quick/instant !!

I forgot something ? I am not crystal clear ? Some spelling mistakes ? Leave a comment !
User avatar
Posts: 9
Joined: Mon Sep 03, 2012 9:04 am
by exwaver » Tue Sep 04, 2012 3:14 am
This is crystal clear, especially for a linux novice such as myself. Why can't others detail their instructions as clear and concise as yours rather than assume we know the basics and ramble on with little bits of code here and there with bits missing in between.

I don't know how to do it but your code example should be entered on the http://elinux.org/RPi_Tutorials website, which is an excellent website for beginners.

Thank you.
Posts: 23
Joined: Thu Jul 05, 2012 10:34 am
by truehl » Tue Sep 04, 2012 5:33 am
Thanks for this, it's crystal clear! One thing would be fine: How can I savely remove minidlna, including the automatically start up?
truehl
http://www.squeezeplug.de
User avatar
Posts: 619
Joined: Sun Mar 04, 2012 6:47 pm
by Anoflix » Tue Sep 04, 2012 8:46 am
Thank you for your comments and suggestions !
I would like to EDIT my post and correct some mistakes, but I don't find any EDIT button... ??
User avatar
Posts: 9
Joined: Mon Sep 03, 2012 9:04 am
by truehl » Tue Sep 04, 2012 8:49 am
You can't edit if you have replies!
truehl
http://www.squeezeplug.de
User avatar
Posts: 619
Joined: Sun Mar 04, 2012 6:47 pm
by Anoflix » Tue Sep 04, 2012 9:04 am
OK :P

To complete the TUTO:

Uninstalling minidlna :

Remove automatic start at boot :
Code: Select all
sudo update-rc.d -f minidlna remove

Stop service :
Code: Select all
sudo service minidlna stop

If there is a problem by stopping the service, just kill it :
Code: Select all
sudo killall minidlna

Completely uninstall minidlna :
Code: Select all
sudo atp-get remove --purge minidlna
User avatar
Posts: 9
Joined: Mon Sep 03, 2012 9:04 am
by simonIOW » Wed Sep 05, 2012 8:39 pm
Just a quick gotcha that I fell into.

My external drive is NTFS, so I needed to do
Code: Select all
sudo apt-get install ntfs-3g
and set up my fstab using ntfs-3g.

Apart from that, very good, ta!
Posts: 34
Joined: Thu Jan 05, 2012 3:25 pm
by oreosxe » Fri Sep 14, 2012 12:10 pm
Really fantastic and easy guide. Thank you. Everything worked perfectly
Posts: 9
Joined: Fri Sep 07, 2012 3:01 pm
by walax » Fri Sep 28, 2012 7:20 am
Followed the guide, had it work perfectly.

Has anyone managed to watch a movie on an android device with a separate srt file ?
Posts: 7
Joined: Wed Sep 19, 2012 6:55 pm
by tpereira » Fri Sep 28, 2012 10:13 pm
Not sure if anyone encountered this issue before, but the minidlna service runs with the user minidlna who would not have permission to create the dir in /home/pi (db_dir=/home/pi/.minidlna).
I have to manually create it and grant permissions -
mkdir /home/pi/.minidlna
chmod 777 /home/pi/.minidlna

Else it wouldn't scan my specified media folders.

Cheers!
Posts: 3
Joined: Sat Sep 22, 2012 6:55 pm
by Anoflix » Thu Oct 04, 2012 9:42 am
I'm looking for how to use srt files as subtitles but I did not find anything...
but...

Wooaaw this TUTO reached the 1 MiIlion views :shock: :shock: :shock: :shock: :shock: :shock:
User avatar
Posts: 9
Joined: Mon Sep 03, 2012 9:04 am
by malakai » Thu Oct 04, 2012 9:48 am
This is a very great tutorial I have a PS3 always looking at playing with it and the Pi thank you and congrats on 1million+ :D :mrgreen:
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)
User avatar
Posts: 1383
Joined: Sat Sep 15, 2012 10:35 am
by JustinPayne » Sun Oct 14, 2012 11:06 pm
tpereira wrote:Not sure if anyone encountered this issue before, but the minidlna service runs with the user minidlna who would not have permission to create the dir in /home/pi (db_dir=/home/pi/.minidlna).
I have to manually create it and grant permissions -
mkdir /home/pi/.minidlna
chmod 777 /home/pi/.minidlna

Else it wouldn't scan my specified media folders.

Cheers!

Yep, I ran into the same issue and had the the same solution. I'm not a fan of 777ing files but as long as it works, I'll do that until someone gives me a better solution.
User avatar
Posts: 8
Joined: Thu Sep 06, 2012 3:57 am
Location: Kent, Wa
by JustinPayne » Mon Oct 15, 2012 3:07 am
I've seen a lot of people report an error about favicon.ico. I know what this is and I assume it allows me to use my own favicon on the status page but for the life of me I can't figure out where to put this file.
Any ideas?
User avatar
Posts: 8
Joined: Thu Sep 06, 2012 3:57 am
Location: Kent, Wa
by jaromanda » Tue Oct 16, 2012 12:13 am
JustinPayne wrote:
tpereira wrote:Not sure if anyone encountered this issue before, but the minidlna service runs with the user minidlna who would not have permission to create the dir in /home/pi (db_dir=/home/pi/.minidlna).
I have to manually create it and grant permissions -
mkdir /home/pi/.minidlna
chmod 777 /home/pi/.minidlna

Else it wouldn't scan my specified media folders.

Cheers!

Yep, I ran into the same issue and had the the same solution. I'm not a fan of 777ing files but as long as it works, I'll do that until someone gives me a better solution.


Two suggestions:

1) find out which group minidlna runs under, then chgrp {minidlnagroup} .minidlna && chmod g+rwx .minidlna; or
2) don't store the minidlna db in /home/pi/.minidlna - in my "big" linux system, it lives in /var/lib/minidlna - but /home/minidlna is just as valid (owned by minidlna user)

unlike the excellent tut, I know I'm sketchy on the details. Either someone can fill in the details, or wait until I get my new Pi (ordered today, should be here tomorrow), and I'll expand on the ideas I've suggested
I now own 2 RPi - does that mean I own a circumference?
Posts: 93
Joined: Wed Sep 12, 2012 12:33 pm
by intman » Tue Oct 16, 2012 7:28 am
Excelent tutorial, sorry for my english.

Two more adds:
- Add samba to comunicate pi with PC (or another device) and share video, photos, etc. (and a tutorial about it :lol: )
- ¿Do you try ps3 media server? its a excelent media server and source code for linux is ready for use (i dont know if its ready for arm device) http://www.ps3mediaserver.org/

Congratulations about this tutorial. Cheers
Posts: 11
Joined: Fri Sep 07, 2012 6:57 am
by sim_tcr » Thu Nov 15, 2012 4:25 pm
worked great.

I am able to pull videos on my Sony 32EX720.
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Transcend 16GB Class 10, Transcend 8GB Class 4, Nokia Travel Charger ACP-12E 5.7V 800mA, Netgear WNA1000M Wifi Dongle/Ethernet
Posts: 311
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
by porferlam » Fri Nov 23, 2012 10:13 pm
When you stream movies(in 5.1 or dts) from the Raspberry Pi to the PS3, is the sound also 5.1 when streaming from the PS3 to a home cinema amplifier?
Posts: 1
Joined: Fri Nov 23, 2012 9:56 pm
by southpaw » Sun Nov 25, 2012 11:43 am
Top marks Georges on a very well written guide, easy to follow for us newbies unlike other guides, quite an accomplishment given your native tongue is probably non English
well done mate and thanks for taking the time to share this
Posts: 46
Joined: Wed Nov 30, 2011 2:23 pm
by leona-pi » Tue Jan 01, 2013 4:44 pm
tpereira wrote:Not sure if anyone encountered this issue before, but the minidlna service runs with the user minidlna who would not have permission to create the dir in /home/pi (db_dir=/home/pi/.minidlna).
I have to manually create it and grant permissions -
mkdir /home/pi/.minidlna
chmod 777 /home/pi/.minidlna

Else it wouldn't scan my specified media folders.

Cheers!


Thank you, this was the problem I was having.
First I saw that miniDlna couldn't create the DB directory, so I created it.
Then it said "fatal: ERROR: Failed to open sqlite database!"
I didn't know what was wrong, till I came across your post, fixed the permissions and now its scanning.

Thank you.
Kind Regards
--------------------
Leona
Posts: 16
Joined: Thu Nov 15, 2012 3:03 pm
by antontre » Fri Jan 04, 2013 1:05 pm
Thank you ! :D
Posts: 3
Joined: Fri Jan 04, 2013 1:02 pm
by leona-pi » Mon Jan 07, 2013 6:34 pm
I didn't see anywhere mentioned about rescanning for new files, is that handled out of the box or do we have to set it up? If so, how?
Kind Regards
--------------------
Leona
Posts: 16
Joined: Thu Nov 15, 2012 3:03 pm
by Anoflix » Wed Jan 09, 2013 10:53 am
Hi,
I'm afraid you have to type...
Code: Select all
sudo service minidlna force-reload

...to update the database.
User avatar
Posts: 9
Joined: Mon Sep 03, 2012 9:04 am
by opodeu » Wed Jan 30, 2013 11:58 pm
Hi (I'am french too)

I have installed the Raspbian Wheezy in my SD card and made apt-get update et upgrade
I have installed minidlna and ntfs-3g package

When I plug my external drive (called MyBook) I have
Code: Select all
pi@raspberrypi /media $ ls -lart
total 22
dr-x------  5 pi   pi     472 Nov 14  2009 WD SmartWare
drwx------  1 pi   pi   12288 Jan 24 18:38 MyBook
drwxr-xr-x 23 root root  4096 Jan 30 21:42 ..
drwxr-xr-x  4 root root  4096 Jan 31 00:09 .
pi@raspberrypi /media $


the command blkid give
Code: Select all
pi@raspberrypi /media $ sudo blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" UUID="3312-932F" TYPE="vfat"
/dev/mmcblk0p2: UUID="b7b5ddff-ddb4-48dd-84d2-dd47bf00564a" TYPE="ext4"
/dev/sda1: LABEL="MyBook" UUID="40284A46284A3AE4" TYPE="ntfs"
/dev/sr0: LABEL="WD SmartWare" TYPE="udf"
pi@raspberrypi /media $


I follow the tuto by creating the directory "Harddrive"

Code: Select all
pi@raspberrypi /media $ ls -lart
total 26
dr-x------  5 pi   pi     472 Nov 14  2009 WD SmartWare
drwx------  1 pi   pi   12288 Jan 24 18:38 MyBook
drwxr-xr-x 23 root root  4096 Jan 30 21:42 ..
drwxr-xr-x  2 root root  4096 Jan 31 00:29 HardDrive


I change fstab
Code: Select all
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
/dev/sda1 /media/HardDrive   ntfs-3g    defaults      0     0
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[on|off]  for that


I have added in minidlna.conf the directory "Film" where I have videos

Code: Select all
media_dir=/var/lib/minidlna
media_dir=P,/media/HardDrive/Film


but when I started minidlna I have in the terminal

Code: Select all
pi@raspberrypi /media $ sudo service minidlna force-reload
[....] Restarting DLNA/UPnP-AV media server: minidlna[2013/01/31 00:52:39] minidlna.c:474: error: Media directory "/media/HardDrive/Film" not accessible! [No such file or directory]
. ok

and in the log
Code: Select all
[2013/01/31 00:52:39] minidlna.c:898: warn: Starting MiniDLNA version 1.0.24 [SQLite 3.7.13].
[2013/01/31 00:52:39] minidlna.c:926: warn: Creating new database...
[2013/01/31 00:52:40] minidlna.c:1006: warn: HTTP listening on port 8200
[2013/01/31 00:52:40] scanner.c:727: warn: Scanning /var/lib/minidlna
[2013/01/31 00:52:40] scanner.c:798: warn: Scanning /var/lib/minidlna finished (0 files)!
[2013/01/31 00:52:40] playlist.c:125: warn: Parsing playlists...
[2013/01/31 00:52:41] inotify.c:195: warn: WARNING: Inotify max_user_watches [8192] is low or close to the number of used watches [2] and I do not have permission to increase this limit.  Please do so manually by writing a higher value into /proc/sys/fs/inotify/max_user_watches.


NB : I can't change right on my external drive

Any Idea how to allow UPNP ?
Posts: 8
Joined: Fri Jan 18, 2013 11:11 pm
by opodeu » Thu Jan 31, 2013 8:54 am
Finally I solve the issue... but I don't know how...
Posts: 8
Joined: Fri Jan 18, 2013 11:11 pm