VDR

From ArchWiki
Revision as of 09:04, 28 January 2009 by Franzb (talk | contribs) (Internet)
Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n links end

Introduction

VDR stands for Video Disk Recorder, an open source software application to turn a PC into a digital video recorder. These initials do not fully explain what VDR is capable of. VDR does also implement all the functions of a modern set-top box to watch either live television or recordings. With the extensive amount of available plugins almost countless features can be added, e.g., play DVDs, play audio and video files, have a look at your photo collection, check your email account...

With its flexibility Arch Linux is perfectly suited for setting VDR up and customizing it. AUR, the Arch Linux User-Community Repository, provides PKGBUILDs for VDR and some of its most commonly used plugins and addons.

This article is devided into three parts. In the fist part I am going to show you how to install VDR on your PC and how to get it up and running. The second part of the article is about how to extend VDR by adding new features like playing DVDs or controlling VDR over the Internet. The third part is about rather advanced features like how to automatically detect and mark commercial breaks in your recordings or how to stream VDR over the Internet.

Initial Steps

This part of the guide is about how to install VDR and how to get it up and running.


Hardware Requirements

VDR is designed to work with a huge variety of DVB cards. See the VDR wiki for whether or not your specific card will be supported. Let me just tell you that so called budget cards, i.e., cards without a hardware MPEG decoder, work perfectly fine with VDR thanks to plugins like vdr-xine.

Installation

Well, thanks to AUR , installing VDR is really simple, just type

yaourt -S vdr

If you own one of the famous full-featured DVB-S cards (with hardware MPEG decoder) from Technotrend (identical in construction to Hauppauge Nexus, Technisat Skystar 1 and Fujitsu-Siemens DVB-S), you might have to do a little extra work since, at least on my computer, a wrong module gets control of the card. On my computer the command "lspci -k" shows the following output:

03:02.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)
	Subsystem: Technotrend Systemtechnik GmbH Technotrend/Hauppauge DVB card rev2.3
	Kernel driver in use: dvb
	Kernel modules: dvb-ttpci, snd-aw2

As you can see, two modules, dvb-ttpci and snd-aw2, are assigned to the DVB card while only the former should take control. Simply add the unwanted one to the list in /etc/rc.conf:

MODULES=(... !snd-aw2 ...)

Also other cards seem to be affected by this specific problem. The solution, however, is always the same: blacklist the module snd-aw2.

A restart of the computer should do the rest. Another two things you might do before the restart: if you own one of those full-featured cards (perhaps also for some other cards), you will also need a firmware for the card to work. For the full-featured Technotrend cards the firmware is dvb-ttpci-01.fw and has to be placed into the folder /lib/firmware. Instead of restarting the computer you just can unload and load the kernel module dvb_ttpci. The second thing which requires at least a new login to take effect is to add yourself to the group "video" (gpasswd -a <username> video).

Configuring VDR

Now you will have to customize VDR's configuration files to your needs. First of all you should edit the file /etc/rc.vdr and make VDR run with standard user rights:

VDROPTS="-u <your username>"

Do also make sure VDR is allowed to write to /video

chown <your username> /video -R


Channel Scan

Then make sure that the file channels.conf in /etc/vdr concurs with the satellite your dish is pointing at. Linowsat provides up-to-date channel lists for all satellites out there. If you own a DVB-T or DVB-C card, w_scan will be your friend (you might have to use translate.google.com for translating the German wiki into English). The package w_scan is available on AUR.

Controlling and Displaying VDR

Eventually, we want to make sure that we can submit controls to and can see the output (live tv and menu) of VDR.

Full-featured cards have got a VGA connector on the card in order to connect an external TV set, alternatively this role can be taken over by DXR 3/Hollywood+ cards. Nevertheless, these possibilities are getting less important nowadays. On one hand with the advent of computer screens with 24 or even more inches the computer screen itself has become very attractive for watching TV, on the other hand, new TV sets do also have an implemented DVI, HDMI, or even DisplayPort input allowing the computer's graphics board to become the output device.

Therefore, this guide focuses on the VDR output on a X-server. BTW, to activate the VGA output of your full-featured card you simply have to connect your TV set using an adequate VGA cable.

For testing purposes it makes sense to control VDR with the keyboard. For how to control VDR by remote control see below. If you have a full-featured card there are two ways of dispaying the VDR screen and to control VDR by keyboard, if you own a budget card, one possibility will be given.


TVtime - Full-Featured Cards Only

TVtime is a TV application which can be used to display VDR's screen. Install the packages tvtime and the wrapper script vdr-tvtime from AUR. To control VDR, adjust the first column of the file /etc/tvtime/maps.txt according to your liking. Here is an example:

m	Menu
Enter	Ok
Backspace	Back
F1	Red
F2	Green
F3	Yellow
F4	Blue
+	Channel+
-	Channel-
u	Volume+
d	Volume-
c	Channels
t	Timers
r	Recordings
s	Setup
a	Audio
n	Info
f	TVTIME_f

Now you can start vdr (/etc/rc.d/vdr start). Then execute the script "vdr-tvtime.pl". TVtime should display the VDR screen and you should also be able to control VDR with the keyboard.

Xine - Full-Featured and Budget Cards

The three plugins vdr-xine, vdr-xineliboutput, and vdr-softdevice, all of which are available on AUR, enable you to use VDR with budget cards. IMO, the one best suited for both budget as well as full-featured cards is vdr-xine, because it has the ability to automatically claim the primary device when xine (of any frontend of xine-lib, e.g., Oxine) connects.

Install the VDR plugin vdr-xine, xine-lib-vdr and xine-ui-vdr from AUR. Edit the VDRPLUGINS entry in /etc/rc.vdr in order that the plugin is being automatically started and restart VDR (/etc/rc.d/vdr restart). The "-r" option allows the pressing of keys in xine to control VDR (see ~/.xine/keymap below).

VDRPLUGINS=" 	\"-Pxine -r\" \
           "

For testing it can also be helpful to start VDR on the command line

vdr -u <your username> -v /video -c /etc/vdr -P'xine -r'


Now start xine once and close it so that the file ~/.xine/keymap is going to be created. Edit this file so that at least the basic keys for controlling VDR will work, e.g.,

# jump to media Menu
Menu {
	key = m
	modifier = none
}

# menu navigate up
EventUp {
	key = Up
	modifier = none
}

# menu navigate down
EventDown {
	key = Down
	modifier = none
}

# menu navigate left
EventLeft {
	key = Left
	modifier = none
}

# menu navigate right
EventRight {
	key = Right
	modifier = none
}

# menu select
EventSelect {
	key = Return
	modifier = none
}

# VDR Red button
VDRButtonRed {
	key = F1
	modifier = none
}

# VDR Green button
VDRButtonGreen {
	key = F2
	modifier = none
}

# VDR Yellow button
VDRButtonYellow {
	key = F3
	modifier = none
}

# VDR Blue button
VDRButtonBlue {
	key = F4
	modifier = none
}

# VDR Command back
VDRBack {
	key = BackSpace
	modifier = none
}

# menu select
Alias {
	entry = EventSelect
	key = KP_Enter
	modifier = none
}

Also remember that you will get an error if you assign a key twice, make sure therefore to change for instance the key for "SpeedFaster" from "Up" to "VOID". It is possible, however, to assign two keys to the same event, you do so with the "Alias" keyword. More information on the Xine website.

Extending VDR

Plugins

As already mentioned in the introduction, plugins are a possibility to add new features to VDR. Some of the most commonly used plugins are available on AUR, I am going to present you some of them:

  • vdr-avards, for Automatic Video Aspect Ratio Detection and Signaling
  • vdr-burn, for creating Video-DVDs from recordings
  • vdr-dvd, for turing VDR into a DVD player
  • vdr-dvdswitch, for playing DVD images from the hard disk
  • vdr-live, for controlling VDR through a web interface
  • vdr-mplayer, a mplayer/mp3 plugin for VDR
  • vdr-osdteletext, displays teletext directly on the OSD in VDR
  • vdr-skinenigmang, provides an alternative skin


How to Setup a Plugin

Plugin Available on AUR

I am going to show you how to install a plugin. I have chosen LIVE as an example. With LIVE you can control VDR over the LAN or even over the Internet. LIVE depends on two additional plugins, epgsearch and streamdev (packages vdr-epgsearch and vdr-streamdev, available on AUR). The former allows you to set autotimers, e.g., you can make VDR record automatically all episodes of Friends or all movies with Al Pacino. The streamdev plugin allows you to stream live tv to other computers over the LAN. You can access LIVE's web interface on port 8008, e.g., http://localhost:8008. For more information have a look at either the web site or the documentation in /usr/share/doc/vdr-live/.

Since LIVE is available on AUR, you can install it with the command "yaourt -S vdr-live". In order that a plugin gets started with VDR you have to edit /etc/rc.vdr

VDRPLUGINS=" 	\"-Plive\" \
             	\"-Pepgsearch\" \
             	\"-Pstreamdev-server\" \
		\"-Pdvdswitch -i /video/dvd\" \
           "

LIVE does not need additional options, unlike the dvdswitch plugin, which is being started with the "-i" option. The dvdswitch plugin can play DVD images from hard disk, the "-i" option tells the plugin where to look for the DVD images.

Plugin Not Available on AUR

The best thing to do if an plugin, you are interested in, is not available on AUR yet, is to write a PKGBUILD according to the AUR Packaging Standards and to upload it to AUR in order that others can benefit.

Remote Control

Once VDR is working you might want to control it not only by keyboard, but relax on the couch using a remote control. On one hand, there is LIRC, which works with every DVB card, because it works independently from your DVB card. On the other hand, provided that your DVB device has an integrated IR-reciever, you might give the plugin vdr-remote a try. Both possibilities will be described here.

LIRC

For installing LIRC see the ArchWiki. To setup VDR to make use of your LIRC remote control you have to adjust the file /etc/vdr/remote.conf. The labeling after "LIRC.",e.g., "Up" has to correspond with the labeling in /etc/lircd.conf, the second column stands for the correspondent VDR command.

LIRC.Up         	Up
LIRC.Down       	Down
LIRC.Menu       	Menu
LIRC.Ok			Ok
LIRC.Back       	Back
LIRC.Left       	Left
LIRC.Right      	Right
LIRC.Red        	Red
LIRC.Green      	Green
LIRC.Yellow     	Yellow
LIRC.Blue       	Blue
LIRC.0          	0
LIRC.1          	1
LIRC.2          	2
LIRC.3          	3
LIRC.4          	4
LIRC.5          	5
LIRC.6          	6
LIRC.7          	7
LIRC.8          	8
LIRC.9          	9
LIRC.Power      	Power
LIRC.Volume+   		Volume+
LIRC.Volume-   	 	Volume-
LIRC.Mute       	Mute
LIRC.Audio      	Audio
LIRC.Recordings 	Recordings
LIRC.Info       	Info

Finally, make sure to add the option "--lirc" to /etc/rc.vdr

VDROPTS="... --lirc"

Remote Plugin

This plugin only works with cards with build-in IR-recievers, as on Technotrend's full-featured cards. Install the package vdr-remote from AUR and use the guide on the VDR Wiki to set it up.

Special Features

This part is meant for advanced users of VDR who might get some little hint on how to enhance their VDR installation.

Noad - No Advertisement

Noad is able to detect commercials and to set cutting marks accordingly. The package "noad" is available on AUR. And let me tell you, noad does a great job. Even though I always check the marks before starting the cutting process it is very seldom that I have to correct them within a movie. It is more outside a movie, i.e., within the recording buffer before and after the movie, that sometimes marks have to be manually eliminated.

By adding the following to the VDROPTS section of the file /etc/rc.vdr, noad is being executed automatically after a recording has been completed.

-r'/usr/bin/noad nice -b -O -C -a -j --statisticfile=/video/noadstat'

The second possibility is to start the commercial detection process manually from the commands menu of the recordings. Just edit the file /etc/vdr/reccmds.conf and add the following line:

start noad: /usr/bin/noad nice --background -O -C -a -j --statisticfile=/video/noadstat

As a third possibility you can start noad on the command line. For how to do that and for an explanation of all the command line options check the README (also available in /usr/share/doc/noad/).

Augment VDR's EPG

xmltv2vdr

Some channels like BBC or ITV do only provide EPG information for the current and the next broadcast which is somewhat unspectacular compared to the standards set by other broadcasting services like ARD (Germany) or ORF (Austria). Fortunately, XMLTV can step into the breach as it is able to get TV-listings for one ore even more weeks in advance. You can follow this guide to install and configure XMLTV.

The XML-file created by XMLTV has to be converted in order that VDR can use the data. For this purpose the script xmltv2vdr has been written, it is availabe on AUR. Install it and follow the README in /usr/share/doc/xmltv2vdr/. The example file channels.conf has been prepared in /etc/xmltv2vdr:

BBC 1 London;BSkyB:10773:h:S28.2E:22000:5000:5001=eng,5002=NAR:5003:1:6301:2:2045:0:london.bbc1.bbc.co.uk
BBC 2 England;BSkyB:10773:h:S28.2E:22000:5100:5101=eng,5102=NAR:5103:1:6302:2:2045:0:london.bbc2.bbc.co.uk
BBC THREE;BSkyB:10773:hC56:S28.2E:22000:5200:5201=eng,5202=NAR:5203:0:6319:2:2045:0:bbcthree.bbc.co.uk
BBC FOUR;BSkyB:10773:hC56:S28.2E:22000:5300:5301=eng,5302=NAR:5303:0:6316:2:2045:0:bbcfour.bbc.co.uk
BBC NEWS;BSkyB:11954:hC23:S28.2E:27500:5000:5001=eng:5003:0:6704:2:2013:0:news-24.bbc.co.uk
CBBC Channel;BSkyB:10773:h:S28.2E:22000:5200:5201=eng,5202=NAR:5203:0:6317:2:2045:0:cbbc.bbc.co.uk
CBeebies;BSkyB:10773:h:S28.2E:22000:5300:5301=eng,5302=NAR:5303:0:6318:2:2045:0:cbeebies.bbc.co.uk
ITV1 London;BSkyB:10759:vC56:S28.2E:22000:2305:2312=eng,2314=NAR:2315:0:10060:2:2044:0:carlton.com
ITV2;BSkyB:10759:vC56:S28.2E:22000:2352:2354=eng,2356=NAR:2358:0:10070:2:2044:0:itv2.itv.co.uk
ITV3;BSkyB:10906:vC56:S28.2E:22000:2362:2356=eng,2357=NAR:2359:0:10260:2:2054:0:itv3.itv.co.uk
ITV4;BSkyB:10759:vC56:S28.2E:22000:2359:2360=eng,2361=NAR:2362:0:10072:2:2044:0:itv4.itv.co.uk
Film4;BSkyB:10714:hC56:S28.2E:22000:2346:2347=eng,2348=NAR:2349:0:9220:2:2041:0:filmfour.channel4.com
More4;BSkyB:10729:vC56:S28.2E:22000:2361:2362=eng,2363=NAR:2364:0:8340:2:2042:0:more4.channel4.com
E4;BSkyB:10729:vC56:S28.2E:22000:2315+2306:2317=eng,2319=NAR:2321:0:8305:2:2042:0:e4.channel4.com


You can create a cronjob to get the updating of the EPG data done automatically, your crontab could look like this:

00 00 * * * tv_grab_uk_rt --config-file ~/.xmltv/tv_grab_uk_rt.conf --quiet > /tmp/uk.xml
05 00 * * * xmltv2vdr.pl -x /tmp/uk.xml -c /etc/xmltv2vdr/channels.conf

vdraepg

vdraepg is a Ruby-script which transfers EPG-data from one channel to another, i.e., the data is not being downloaded from the Internet as with XMLTV, but is already present in VDR's EPG-information.

This makes sense in some cases when, for example, a channel is available on DVB-T, but does not have as elaborate an EPG as the same channel on DVB-S (which, for instance, might even be encrypted). The script can also be used to change the time information. So the script can transfer EPG-data from, e.g., ITV2 to ITV2+1, just by adding one hour to the EPG-information from ITV2.

You can install the package vdraepg from AUR. Read the file /usr/share/doc/vdraepg/README.en for instructions on how to set vdreapg up. An example configuration has been prepared (etc/vdraepg/vdraepg.conf)

#source-channel, target-channel, time-adjustment
S28.2E-2-2044-10070, S28.2E-2-2041-10172, 60 #itv2, itv2+1
S28.2E-2-2054-10260, S28.2E-2-2054-10261, 60 #itv3, itv3+1
S28.2E-2-2042-8335, S28.2E-2-2042-8330, 60 #film4, film4+1
S19.2E-1-1101-28106, T-0-562-1, 0 #ARD, DVBS --> DVB-T

Again it might make sense for you to have vdraepg run as a cronjob:

10 00 * * * vdraepg.rb

Integrating VDR into the Multimedia Center Oxine

VDR, being an excellent, some even say the best, software for dealing with watching and recording DVB, still has some flaws compared to MMCs (multimedia center) like MythTV. Nevertheless, compared to VDR those MMCs have deficits when it comes to dealing with watching and recording DVB. Therefore, it could be a good idea to combine the strengths. The good news is, this is possible. With Oxine exists a MMC which is capable of integrating VDR perfectly into its interface.

The "extra" repository includes the package oxine, unfortunately its configuration does not make the integration of VDR possible. On AUR, though, a package named oxine-vdr does away with this limitation. That said you should easily be able to activate VDR in Oxine's settings pages, just go to "Edit Settings", "Television" and change "type of television" to "video disk recorder". A dependency of oxine-vdr is the VDR plugin vdr-xine, it has to be started with the option "-r" in order that oxine can connect:

VDRPLUGINS=" 	\"-Pxine -r\" \           
           "

Streaming VDR

Local Area Network

Imagine having your computer running VDR somewhere in your study, living room, or even in your cellar and watching live tv and recordings provided by the same VDR on a deck chair in your garden. This whish can be put into practice.

The very same plugin that we already used with budget cards and also to integrate VDR into Oxine we are going to use again to show the VDR frontend on any computer on the LAN or WLAN: vdr-xine. You just have to start the plugin with the "-p" parameter:

VDRPLUGINS=" 	\"-Pxine -r -p\" \
           "

On the remote computer install the packages xine-lib-vdr and xine-ui-vdr, availabe on AUR.

Adjust the file ~/.xine/keymap as described above to control VDR with the keyboard.

Now watch your favorite movies any place in and around your house:

xine "netvdr://<ip of VDR server>#demux:mpeg_pes" -D

Internet

Theoretically the concept of streaming VDR over LAN or WLAN with the plugin vdr-xine can also be adopted to the Internet. The point is, though, that the requirements in terms of bandwith will only be fullfilled in very rare cases. To stream VDR without further compression you are going to need an upstream speed of three or even more Mbit/s, according to the bitrate of the broadcast. Therefore, John Doe has to use highly optimized codecs like H.264 AVC and this is exactly what this part of the tutorial about streaming VDR over the Internet will be about.


VLC is not only a well known multimedia player, but is also perfectly suited to encode and stream video and audio. Therefore, we use it to grab audio and video from a full-featured card to encode and stream VDR over the Internet. You need to install the packages vlc and lame. Adjust "vb=250" (video bit rate) and "ab=48" (audio bit rate) to your upload speed. The two values in the example work great with an upstream of 384 Kbit/sec.

/usr/bin/cvlc -d v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/dsp" :v4l-norm=3 :v4l-frequency=-1 --sout #transcode{vcodec=h264,vb=250,scale=0.5,acodec=mp3,ab=48,channels=1}:duplicate{dst=std{access=http,mux=ts,dst=0.0.0.0:1234}}'

On the remote computer you can open the stream with the following command. If the computer running VDR is behind a router, make sure the port 1234 is being forwarded.

vlc http://<your dyndns>:1234

Even though the quality of the video is visibly diminished, the result is surprisingly great and you can watch live TV and recordings with only little cutback.

You can control the remote VDR with either the LIVE plugin or SVDRP software like "VDR Remote Control" (rather unsecure, since the SVDRP port has to be forwarded on your router). You can even use your iPhone or iPod Touch with the application ZapperPro, available in the Apple Store. As a requirement you need access to to the Internet through WLAN. Be careful regarding the security issue when opening the SVDRP port to the Internet.

Rip a DVD

There are several possibilities to rip DVDs with the help of VDR. I am going to show you a quite simple, but nevertheless effective one. The only packages you need to install are screen and dvdbackup. Dvdbackup automatically gets the title of the DVD and sets the name of the target directory accordingly. In order that you can start the ripping process from within VDR you have to add the following line to /etc/vdr/commands.conf:

Rip DVD : screen -dm sh -c "/usr/bin/dvdbackup -M -i/dev/dvd -o/video/dvd"

You might have to adjust the "-i" (input device) and the "-o" (output folder) option to your needs. The "-M" option backs up the whole DVD including the menu structure. You can alter this, have a look at the available options (dvdbackup -h).

Start ripping a DVD from within VDR's Commands menu. If you want to play the ripped DVD image with VDR, you can use the plugin vdr-dvdswitch, available on AUR.

Conclusion

I remember having almost given up on setting up VDR on Arch Linux at the very beginning because of the problem mentioned above with the wrongly loaded module for my full-featured card. This guide might help some of you to also get beyond the point of only trying to get VDR up and running. I can only encourage you to try out VDR as it is a really terrific piece of software with a wide range of possibilities.

This guide is not intended to be complete and it never will be. Hopefully, with the cooperation of you guys it will become more and more detailed and useful.

References