By Oliver Frommel
Digital TV on Linux is commonly associated with time-consuming installation procedures. Setting up MythTV is a challenging experience, and the alternative VDR system is anything but trivial - unless you happen to use a specialized distribution such as LinVDR, that is.
Klear  is a GUI-based program that makes it much easier to play and record DVB programs. The program was written by Patric Bico Sherif, Omar El-Dakhloul, Manuel Habermann, and Marco Kraus at the Technical University in Berlin as part of a course in programming. Klear uses the Qt toolkit to provide a GUI and assumes a working DVB subsystem, although most current kernels should support DVB hardware without any trouble. The DVB-S/T/C devices sections on the LinuxTV wiki  tell you which PCI cards and DVB USB sticks are supported by Linux.
To build the package yourself, you need both the Qt and KDE developer packages (kdebase-devel, kdebase-dev, or similar), along with Xine. Most distributions have ready-to-run packages for the Scons  build tool, which is also a required component. In contrast to most other free software projects, Klear does not give you a configure script; instead, Klear provides a shell script titled build.sh. When you run the script, it first checks dependencies before going on to the build.
You can also launch scons directly. Running scons help outputs the available parameters, which you might need to set up non-standard paths to the libraries you use. In our lab, we experienced an issue with a few systems that failed to find the libxine.so library. In most cases, we just set up a symbolic link from libxine.so.1 to libxine.so in the /usr/lib directory to resolve this. After completing the build, you can install the program by running scons install as root.
When you launch Klear for the first time, Klear tells you that you do not have a configuration file and displays the DVB device file settings in a dialog. You can normally just accept the default values adapter0, dvr0, demux0, and frontend0. If you are experiencing difficulties, make sure that these files are in /dev/dvb, and make certain that you have the necessary read and write access to the /dev/dvb directory.
Klear also expects a file titled channels.conf in the $HOME/.klear directory; this is where the channel frequency data for your location is stored. Check out the Klear homepage for a sample file.
To launch a TV channel, just double-click the channel name in the list. After a tuning delay of a few seconds, the picture should appear in the Klear window (Figure 1). To hide the controls, press the [M] key or click the corresponding button (Figure 1). You can press the [M] key again to display the controls. Pressing [F] or clicking the corresponding button takes you to full-screen mode. However, this feature only works on KDE at this time. The authors are working hard to bring full-screen mode to Gnome Klear users in the near future.
You might note some interference with moving images; after all, the DVB stream is designed for viewing on TV sets that use an interlaced mode computer monitors can't give you. De-interlacing is the answer: just click the button or press the [D] key to enable and disable the de-interlace feature. Unfortunately, Klear waits until the last minute to clear up the picture, and this means that screenshots ([S] key) and any streams you record will still have interlace stripes. Your best approach may be to use a tool such as Transcode or Mencoder to enable de-interlacing when converting to a different format at a later stage.
You can use either the channel list or the [Pg-Up] and [Pg-Dn] keys to switch channels. If Klear crashes when you switch the channel, just disable the Automatic OSD display on switching setting in the General tab. The program is more stable without OSD.
To record the current program, just press the record button or the [R] key. You might like to set up a different target directory below Recording to avoid the default setting of the Desktop directory. Klear gives you a choice of two recording formats: MPEG transport stream (MPEG-TS) and program stream (PS). There is not much difference between the formats, but recording with the transport stream is easier on your CPU.
DVB programs are useful for their ability to schedule multiple programs for recording. Klear gives you an electronic program guide (EPG) to help you with your planning; the EPG gives you a channel's schedule well in advance for a number of days. Just select a program and press the record button. Klear pops up a dialog where you can make changes, for example, stopping a recording a few minutes later, just in case the TV program is running behind schedule.
You might not be thrilled with the idea of leaving Klear running until three o'clock in the morning to record a program, but don't worry; the Klear developers have a simple, but functional, workaround. Enable Mute on iconizing in the settings below General. Now, when you iconize the application via the window title bar (not via the Klear menu), it will be quite happy to sleep in the KDE kicker until it is time to record - this does not work on Gnome at present. Gnome users will have to mute the stream manually, by pressing [V], and iconize the Klear window. After storing the recording on disk, you can use a program such as DVBCUT  to cut the recording before converting to the required target format. DVBCUT is tailor-made for this chore and can handle DVB MPEG formats.
Klear has the functions a practical DVB program needs and avoids feature overkill. You can watch TV and schedule recordings. Of course, you will need KDE to make full use of the program's features. Gnome users have to do without genuine full-screen mode support. Occasional crashes spoil the digital TV viewing fun. Improving stability and bringing the program's full feature scope to other desktops are at the top of the developers' to-do list.
 Klear: http://www.klear.org/
 LinuxTV wiki: http://linuxtv.org/wiki
 Scons: http://www.scons.org
 DVBCUT: http://dvbcut.sourceforge.net
For several years Oliver was a sysop and programmer at Ars Electronica Center in Linz/Austria.
After finishing his studies in Philosophy, Linguistics and Computer Science he became an editor for the Bavarian Broadcasting Corporation. Today he is head of the Editorial Competence Center for Software and Programming at Linux New Media AG.