Recipe to Watch TV

What follows is a step by step list what to do to watch TV on your Raspberry. First the checklist:

  • Raspberry Pi device
  • Optional: a license for decoding MPEG 2 data
  • Supported DVB-S, DVB-S2 USB device

Kernel Update

Because the Kernel that is provided with the Raspberry image does not contain the required modules for DVB USB devices, the Kernel must be upgraded. The easiest way to do this is to use an automatic script, for instance rpi-update. For safety reasons, the old image from the card should be backuped. After the process is done, the device can be booted.

Setting up the DVB environment

In case the DVB devices needs a special firmware, it has to be downloaded first and placed in /lib/firmware. To make sure that all required Kernel modules are available on startup, they should be placed in the /etc/modules file. We will demonstrate the steps for the Technotrend S-2400. The name of the required firmware is dvb-usb-tt-s2400-01.fw and the required modules are dvb-usb-ttusb2, dvb-usb. To test the process the command modprobe dvb-usb-ttusb2 can be used (as root).

Testing the DVB environment

As a first step, the package dvb-apps has to be installed. The packet contains the application gnutv that is used to receive the DVB data. The omxplayer should be already installed. However, it might be a good idea to update it to make sure you always have the newest version. We assume that a channels.conf has already been created or is available and is stored in /etc.
To test the actual reception, the command gnutv CHANNEL can be started, where CHANNEL is the name of the channel to tune-in. In case of any problems, a short error description is shown and the process will exit. Otherwise, if everything works, the channel will be locked in and the program goes into an infinite loop. The process can be now aborted, because everything works fine.

Watching TV

To make sure that the sound card is working and omxplayer is able to playback MPEG data, omxplayer should be manually started once with an MPEG file. 
Since the DVB streams are not available as files, we will create a FIFO to pass the data from gnutv directly to omxplayer. This can be easily done with mkfifo /tmp/mystdin. The next step is to feed the FIFO with data from gnutv and let omxplayer read from the fifo.


gnutv -buffer 1048576 -out file /tmp/mystdin "COMEDY CHANNEL" &
sleep 1
omxplayer /tmp/mystdin

After some seconds the MPEG stream should be directly displayed in front of the console text. To quit the player, ‘q’ should be pressed.

We are working on a python framework to automate these steps and to provide support for IR receivers that are usually bundled with DVB-S USB devices. The first test was very promising but more tests need to be done and the code needs cleanups before we will release it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s