MediaServer with Rygel

Rygel XVI
Image by Cayusa via Flickr

Like a lot of  people, I have one of those set-top TV boxes that can record TV shows at set times.  I made sure that I could get at the files (using a FTP server in this case) and that the files were some sort of common standard (MPEG 4 TS).  I also have a bunch of mp3 music files.

That’s fine when I’m on the desktop because the files are local.  I wanted to make these available to anyone in the household. DLNA seemed to be a reasonably OK way of doing this, the problem was, how to get it working in Linux?

A lot of the problem is that it is hard to find a DLNA only server.  Sure MythTV could do it, but it needs a tv tuner or a lot of fiddling around.  XMBC can also do it, but it needs to be running a GUI.  I even tried mediatomb but could not get the thing to compile as the library calls to mozjs were all using deprecated functions. I just wanted a daemon that served stuff, nothing more; no fancy ui, no need for X just file serving goodness.

Rygel is almost that.  You could say it is a user server much like a torrent client/server.  The nice thing is you can fiddle around with rygel so it becomes close to a real server.  This is how I did it.

First, I made a rygel user with a home directory, but disabled login. I don’t like programs running root if they don’t need it and rygel doesn’t need it.  The home directory needs to be writeable to the rygel user too otherwise the program doesn’t work too well. I use /var/local/rygel as its home.

For the configuration, copy /etc/rygel.conf to ~rygel/.config/rygel.conf  This is the configuration file for rygel. I disabled all of the modules except MediaExport. Make sure you disable Tracker otherwise MediaExport will not work. Tracker is only useful for real users who are logged in and have dbus etc going which this user is certainly not.

I made a simple rygeld file in /usr/local/sbin which basically starts the program, forks and grabs the PID to write to a pidfile. This mean it was easier to track the program in the init scripts.

#!/bin/sh
#
# Rygel daemon handling
RYGEL='/usr/bin/rygel'
RYGEL_ARGS=''
su -s /bin/sh -c "nohup $RYGEL $RYGEL_ARGS > /var/local/rygel/rygel.log 2>&1 &"
rygel
EXIT_CODE=$?
if [ $EXIT_CODE != 0 ] ; then
        return $EXIT_CODE
fi
PGROUP=`ps --no-headers -o pgrp $$`
PID=`pgrep -g $PGROUP -f $RYGEL`
echo $PID > /var/run/rygel.pid
exit 0

In case you were wondering, the pgrp finds the program group so the pgrep finds the right rygel process that has the same program group as the starting shell.

The init script is a standard init script except the –exec flag checks for /usr/bin/rygel but the start line starts /usr/local/sbin/rygeld  This is because we want to kill the real rygel process but start it with the script.

This setup works rather well. You do get some messages in the logfile about dbus not working but it is harmless. I tried disabling the mpris and external plugins but no matter what flag or configuration file option I tried, they would always try to start and fail with no dbus.

Rygel is a a reasonably light-weight way of serving media to your home network. It idles 200 MB virtual with 16MB resident and when idle uses almost no CPU.

 

Enhanced by Zemanta

Comments

11 responses to “MediaServer with Rygel”

  1. Jens Georg Avatar
    Jens Georg

    Thanks for your post 🙂

    Yes, the only way to disable those two plugins completely is to delete them; you can only disable individual peers, but not the complete module. There’s at least a TODO item about that.

    If the Tracker plugin is disabling MediaExport despite Tracker is not available, that’s clearly a bug that you should report.

  2. A good example of a minimal DLNA server would be minidlna. Did you try it?

  3. Did you look at minidlna?

  4. klaernie Avatar
    klaernie

    try minidlna. Packaged in debian and does exactly what you wanted. Small deamon, just sharing media via dlna.

  5. I was in that situation some time ago, and rygel seemed a bit too fat dependency wise for my taste and box! Tried gmediaserver for a while, then switched to minidlna, and I’m pretty happy with it now.

  6. You may have a look to minidlna too, it’s very easy to setup and available in debian.

  7. aptitude install minidlna
    😉

  8. Zeeshan Ali Avatar
    Zeeshan Ali

    Guillem, gmediaserver? Seriously? You’ll prefer that over Rygel just because it has very few deps and small? Not concidering its totally stupid, incomplete and unmaintained for years? You overobsession with minimalism disapoints me.

    Rygel focuses on getting things working and doesn’t depend on anything that is not readily available on a typical desktop (yes, everyone should use GNOME or some variant of it :)).

  9. Thanks for all you comments. I did see minidlna but it appeared from the description to be a bit too minimal. That could be perhaps due to how I read the description and not a fault of minidlna at all. Rygel does transcoding which I don’t think minidlna does. As I am only a week into using this, I still not sure if this is a real benefit or not.

  10. Thanks for this! I tried minidlna but what I need is a renderer, not a server. I disabled everything in rygel except for playbin. Then I just needed a way to start it via init scripts.

  11. Michael Avatar
    Michael

    Full success with, minidlna! Thanks for the hint! I wrote a report about it on my blog: http://nofunnystuff.michaelfranzl.com/minidlna/

Leave a Reply

Your email address will not be published. Required fields are marked *