Personal Video Recorder Basics
Once the base distribution is up and running, we need a driver for the card. You can get the CVS version at linvdr.org/download/vdr/Developer. At the time of this writing, linux-dvb.2003-09-05.tar.bz2 is the latest version. The current drivers sometimes hang when disconnecting the satellite cable or the reception drops to zero. You then have to remove and re-insert the drivers, which does not always work, leaving you with the need to reboot to get it up and running again. These hangs can be especially pesky if you're simply recording something or are in the middle of a movie, but they usually don't happen.
Now go to /usr/src, unpack the driver snapshot and mv it to DVB. Renaming the directory is important because certain patches and plugins rely on directory names. Go to the DVB directory and type make to compile the driver and some useful applications that help you scan the satellites to retrieve a list of channels. make install is not needed because the runvdr script we use later takes care of the module loading. It's important to run the makedev.napi script after compiling the drivers, as this script creates the needed entries in /dev.
If you live outside of Europe or don't use the Astra satellites, you have to use a different channel list. Scanning for channels is an automated process. A tool called scan comes with the DVB driver, and you can find it in the /apps/scan directory. Invoke it with the -o vdr option so the output file is in VDR's channel format. To capture the newly created channel file, you need to redirect the programs standard output with this command:
./scan -o vdr > channels.conf
Fetch vdr-1.2.5.tar.bz2, unpack it in /usr/src and change to that directory. Installing VDR can be a bit tricky. Because you can use some patches to spice up the features, you quickly can end up in patch hell if you're not careful. The best idea, if you want to use multiple patches, is to get your hands on an all-in-one patch. I used nothing but the Elchi patch, which gives the rather dull default VDR interface a nice face-lift. If you have the right patch for your VDR version, you shouldn't encounter any problems.
The range of additional functions added by plugins goes from simple games to e-mail alerts to full-featured DVD playback. Here, install only two, the remote plugin and the MP3/MPlayer playback plugin. The remote plugin is necessary only when using the original remote from Hauppauge. The MP3/MPlayer plugin, on the other hand, is a must-have.
Change to /usr/src/vdr-1.2.5/PLUGINS/src and unpack the two packages. VDR's Makefile won't build the plugins until you strip the version information from the directory names, so rename them to remote and MP3. The MP3 plugin has some additional requirements, namely libsndfile, libmad and libid3tag. Since Red Hat ships without MP3 support, you have to install them manually. Fetch them from www.freshrpms.org, and don't forget to install the development packages. When everything is set, type make REMOTE=plugin NEWSTRUCT=1 all plugins. The REMOTE=plugin parameter adds another input method using the remote plugin. You can use Lirc to select whatever remote you happen to find; VCR ones do rather well. Simply add REMOTE=lirc in that case. Keyboard support is enabled by default and shouldn't be disabled, as it can be very helpful for debugging. The NEWSTRUCT=1 is needed to tell the plugins to search for the new drivers in /usr/src/DVB.
Having compiled everything, we now need to edit the startup script a bit. As a basis, use the one supplied with the remote plugin. You can find it in the misc directory, named runvdr.remote. This script loads a keymap so the signals from the remote are decoded. This is used only with Hauppauge's IR receiver. If you don't have one, use the runvdr script in VDR's root as a starting point. Move the runvdr.remote script to VDR's root and fire up your favorite editor. On line 24 you should find the parameters by which vdr is started. Mine looks like this:
VDRCMD="$VDRPRG -w 60 -P scanner \ -P\"mplayer -M /video/plugins/mplayer.sh\" \ -P mp3 \ -P\"remote -i /dev/input/event1\" $*"
If you're unsure what you need to add, simply run vdr -help, and you should see a list of all usable modules and their options, along with all of VDR's options. Don't worry, it's fairly easy to find out what to add. To finish up, we need a base directory; the default (as defined in Make.config) is /video. This directory holds all the recordings and configuration files. Copy the sources.conf and your channels.conf to /video.
The only thing left for us to do is write configuration files for the MPlayer/MP3 plugin. Start by creating a directory named /video/plugins. Now we need two files, one called mp3sources.conf and one called mplayersources.conf. Writing them is simple. For starters, add something like /video/music;Local files;0 for mp3sources.conf and /video/compressed;Local files;0 for mplayersources.conf and save them. To get MPlayer to work with the DVB card, you have to recompile. Grab a copy from www.mplayerhq.hu, and add --with-extraincdir=/usr/src/DVB/include to your configure options. Let the configure script run, recompile and install, and you're good to go.
As you can see from the runvdr script, the MPlayer plugin uses a special shell script to start MPlayer, mplayer.sh. You can get that from batleth.sapienti-sat.org/projects/VDR. The package consists of only two files, mplayer.sh itself and mplayer.sh.conf, which holds some configuration options. If your machine is too slow to play back files using MPlayer, you should try tweaking the settings in this file.
- August 2015 Issue of Linux Journal: Programming
- Django Models and Migrations
- Hacking a Safe with Bash
- Secure Server Deployments in Hostile Territory, Part II
- The Controversy Behind Canonical's Intellectual Property Policy
- Huge Package Overhaul for Debian and Ubuntu
- Shashlik - a Tasty New Android Simulator
- Embed Linux in Monitoring and Control Systems
- KDE Reveals Plasma Mobile
- diff -u: What's New in Kernel Development