Watching Digital TV Via Kaffeine

Kaffeine is a media player application that uses the KDE libraries. As part of my work maintaining the Linux Kernel media subsystem I needed some tools to test whether or not the digital TV core support works properly and to test Linux drivers for new devices. So, I’ve recently been working to improve Kaffeine to offer the necessary features for such tests. As part of this, I recently created a major Kaffeine version (2.0) that uses the latest version of KF5 (KDE Frameworks 5), and to use Qt5 library. I also started helping with upstream Kaffeine maintenance.

UPDATE: Added instructions for Arch Linux

Watching Digital TV Via Kaffeine - kaffeine_about
Kaffeine now supports KDE 5 and Qt5

How to Install Kaffeine

Installing Kaffeine is easy.

If you run openSUSE Tumbleweed, you can find an up-to-date package with the latest state of development tree in the KDE:Unstable:Extra repository. So, to use the newest version of Kaffeine, all you need to do is to run:

# zypper ar obs://KDE:Unstable:Extra KDE_Unstable_Extra # add repository
# zypper in -r KDE_Unstable_Extra kaffeine

On Gentoo, installing Kaffeine 2.0.1 is as simple as:

# emerge kaffeine

On Arch Linux, installing Kaffeine version 2.0.x is as simple as:

# pacman -S kaffeine

On other distributions the best method is to use git to retrieve the last version:

$ git clone git://

A number of packages are needed to build it; the README file contains instructions for both Debian and Fedora:

On Debian (and Ubuntu), you should run the following as root:

# apt-get install kdelibs5-dev libvlc-dev libxss-dev libkf5idletime-dev vlc \
		   libkf5coreaddons-dev libkf5i18n-dev libqt5x11extras5-dev \
		   libkf5solid-dev libkf5widgetsaddons-dev kio-dev \
		   qt5-default libdvbv5-dev libkf5notifications-dev \
		   cmake extra-cmake-modules make g++ gettext

On Fedora, you should run the following as root:

 # dnf install  kf5-kcoreaddons-devel extra-cmake-modules libXScrnSaver-devel \
		qt5-qtx11extras-devel kf5-kidletime-devel \
		kf5-knotifications-devel kf5-solid-devel kf5-kio-devel \
		kf5-kdbusaddons-devel kf5-ki18n-devel vlc-devel gettext-devel

Then, run cmake:

$ cd kaffeine; cmake . 

If some packages are missing, cmake will complain. Otherwise, you can build it with make:

$ make

If you want translations too, you should run:

$ (cd ..; kaffeine/tools/

Finally, Kaffeine is installed by running the following as root:

# make install

Kaffeine Player Basic Functionality

Like many other media players, Kaffeine supports a wide range of video and audio formats as well as playing audio and video from DVD and CD. Additionally, it supports live Digital TV playback if your machine has a Digital Video Broadcast (DVB) device plugged into it. Once Kaffeine starts, it presents a screen with the main functions in the middle, and it’s possible to switch to other functions via either the pop up menu or the lateral menu:

Watching Digital TV Via Kaffeine - kaffeine_initial.png

Playing a video or audio file is as simple as clicking on the Play File button. It will ask you to select the file to be played, and wil begin playing it. Since Kaffeine uses LibVLC for the backend it supports all the same file formats as VLC. It also supports opening a list of files to create and manage playlists.

Watching Digital TV Via Kaffeine - kaffeine_file_play

Worldwide video standards and Linux Kernel support

I want to take a moment to describe how media software and hardware play digital audio/video streams. There are quite a few variations of video standards around the world. Building software to support most of these standards is a very tough challenge. For example, there are 4 Digital TV standards for terrestrial (air) broadcast worldwide:

  • ATSC – used mainly in Mexico, USA, Canada and South Korea
  • ISDB-T – used mainly in Japan, South America, Central America and some countries in Asia and Africa
  • DVB-T – used mainly in Europe, Asia and Oceania. There’s a second generation of this standard called DVB-T2
  • DTMB – used in China

These are shown in the following image:

Watching Digital TV Via Kaffeine - Digital_broadcast_standards

Additionally, there are two public standards used for digital TV via satellite:

  • DVB-S – used in most countries. There’s a second generation of this standard, called DVB-S2
  • ISDB-S – used in Japan

Finally, there are two public standards for Cable TV:

  • DVB-C – used in most countries (also known as ITU-T J.83 Annex A and Annex C). There’s a second generation of the standard, called DVB-C2, but it is not widely used yet
  • clearQAM – used mainly in Mexico, USA, Canada and South Korea (also known as ITU-T J.83 Annex B)

Before 2008, the Linux Kernel only supported ATSC and the first generations of the DVB standards. In 2008 – with the addition of the DVB API version 5 – support for other standards was gradually introduced starting with DVB-S2. Yet, most Linux applications still don’t use the Linux DVB version 5 API, or use it only for DVB-S2.

Digital TV hardware

As shown in my previous article on Media Controller Support for Digital Video Broadcasting, a digital TV device has several internal components:

Watching Digital TV Via Kaffeine - Media-Devices-Block-Diag
Media device block diagram

The digital TV frontend is the piece of hardware that is dependent on the standards; it’s responsible for tuning into a TV channel and outputting a MPEG transport stream data for the digital TV decoder. When the Linux APIs were conceived, frontends were bound to one specific digital TV standard. However, on modern hardware the same frontend can work with multiple digital TV standards. There are hardware devices available in the market that can even support all digital TV standards in a single component. Such devices require the use of the Linux DVB API version 5 in order to be capable of dynamically changing the supported TV standard on the frontend in real time.

Kaffeine as a Graphical User Interface for Digital TV

While the basic functionality is useful enough for someone who wants a simple, yet powerful media player, the best feature in Kaffeine is to use it as a GUI frontend to watch and record digital TV. Kaffeine version 1.2 and 1.3 were limited to ATSC, clearQAM, DVB-T and DVB-S and DVB-S2. Yet, it doesn’t support some modern hardware that have a single silicon chip which is capable of supporting multiple standards.

In Kaffeine version 2.0 the digital TV support was extended to support DVB-T2 and ISDB-T. Since it now uses libdvbv5, extending support for other digital TV standards is simple. Also, since it uses the Linux DVB version 5 API, it supports frontends capable of implementing multiple TVs at once.

Setting the TV configuration on Kaffeine is as simple as clicking on the Television pop up menu, and selecting the Configure Television option. A pop up window will open that requests the parameters to be used:

Watching Digital TV Via Kaffeine - kaffeine_tv_configuration

The Device menus have the per-device setup. Usually selecting the country and the city in the Source combo box (or using one of the Autoscan sources) is enough for non-satellite configurations. The same happens for devices that support multiple TV standards:

Watching Digital TV Via Kaffeine - kaffeine_channel_settings_multiple_stds

After clicking on the Ok button, the next step is to scan for the digital channels, using the Television pop up menu, option Channels:

Watching Digital TV Via Kaffeine - kaffeine_channel_scanning

If more then one standard is supported, the Source combo box will allow you to select the one that will be used to scan. Don’t forget to connect the device’s antenna cable to match the standard that will be used. Then, click Start Scan to start scanning for channels. Once finished, the discovered channels will appear on the left. These channels can be copied to the left side by clicking Add filtered. It is possible to check the tuning parameters for the channel in the left side by clicking on the Edit button. Some parameters are adjustable in the window that pops up.

Watching Digital TV Via Kaffeine - kaffeine_channel_settings

Once the channels are saved, watching TV is as simple as clicking on the Digital TV icon in the main window:

Watching Digital TV Via Kaffeine - kaffeine_live_view
Side note: the above window is using a different language one purpose to show that Kaffeine also has translations for 56 languages.

Kaffeine also allows you to click on the Watching Digital TV Via Kaffeine - media-playback-pause button to pause it. When the button is clicked, Kaffeine will record the program and once the start button is pressed it will start the program from the point it was paused. There is also a Watching Digital TV Via Kaffeine - document-save button that allows you to quick record and save the program to disk.

Recording Programs in Kaffeine

Besides clicking on the record button( Watching Digital TV Via Kaffeine - document-save) when the live view is opened, Kaffeine has other ways to record a program. One method is to select the program to be recorded using the Television pop up menu and selecting the Program Guide option. It will present a list of programs that were identified on a previously played program:

Watching Digital TV Via Kaffeine - kaffeine_epg

Clicking on the Watching Digital TV Via Kaffeine - media-record (Record Show) button will mark the program to be recorded. The record needs to be enabled via the Recording Schedule option, also located in the Television menu:

Watching Digital TV Via Kaffeine - kaffeine_record_schedule

By clicking one the New button, it is also possible to directly define a time and duration for a program to be recorded.

Kaffeine offers many more options and this is only a sneak pick of the most used functions. We’ve made a great effort to port it to KDE 5 and fix several issues to make it ready for others to use. We hope you’ll enjoy our efforts! Have Fun!

Note: the icon images above are licensed as LGPL and are part of the Breeze icon set on KDE 5.

Author: Mauro Carvalho Chehab

Mauro is the maintainer of the Linux kernel media and EDAC subsystems and Tizen on Yocto. He's also a major contributor to the Reliability Availability and Serviceability (RAS) subsystems.

6 thoughts on “Watching Digital TV Via Kaffeine”

  1. Thanks a lot for this superb development

    KaOS offer this version of Kaffeine in the default repos:

    sudo pacman -S kaffeine

    install it

  2. Mauro,

    How can I configure ISDB-T for Chile Channels, there is a way to import the channels.conf that is used in vlc?

  3. You made my day!

    Thank you, now I`m able to use my Astrometa DVB-C USB Stick with Linux Mint and Koffeine.

  4. I purchased a USB HDStar V3 satellite box 2 years ago that has been worthless to me until Ubuntu 17.10 , Kaffeine 2.0 and v4l-updatelee all worked together to make it work perfectly on every channel. I even kept my ethernet this time. Great work! Thank you.

Comments are closed.