Raspberry Pi: Live television with tvheadend

The Raspberry Pi can be used in many ways. One of them: streaming a DVB signal into the network, e.g. to watch live TV in rooms without good DVB-T reception.

DVB-T and DVB-C simultaneously, streamed via tvheadend from Raspberry Pi
DVB-T and DVB-C simultaneously, streamed via tvheadend from Raspberry Pi

What you need for that: a Raspberry Pi, a DVB-T stick which is supported by Linux as well as a suitable client (if you don't want to use XBMC directly on the Raspberry) and a USB hubbecause the USB ports on the Raspberry do not supply enough power. In my case I use the solution to use my DVB-T stick with Mac-OS-X, where it is unfortunately not directly supported.

Meanwhile I have added the setup to DVB-C Support extended, because the cable connection is unfavorably located in the living room. This makes it easy to distribute digital cable TV in several rooms - at least if you restrict yourself to unencrypted channels. You don't even need many parts, the costs are mainly caused by the USB stick for DVB-T or even more expensive DVB-C. Most important is the Linux support, otherwise you will get a problem if you TVHeadend to use.

Shopping list for live TV with RaspberryPi
The following parts are required to implement this manual:

Installation of the DVB-T stick under Raspbian

Among other things I use a Terratec Cinergy HT USB XEwhich first of all lacks the appropriate firmware (compatible drivers are available for the Sundtek MediaTV Pro III). With a short Linux command (has to be executed on the console) you get a list of kernel messages - there you can also see which firmware file is expected:

~# cat /var/log/dmesg

At linuxtv.org there are the corresponding files, the suitable one is simply copied to /lib/firmware after a restart at the latest, the firmwares are loaded and the DVB-T stick can be used. The dmesg output should now show no errors or missing files related to the stick. In my case the final result looks like this:

dvb-usb: found a 'Terratec Cinergy HT USB XE' in cold state, will try to load a firmware
dvb-usb: downloading firmware from file 'dvb-usb-dib0700-1.20.fw
dib0700: firmware started successfully.
dvb-usb: found a 'Terratec Cinergy HT USB XE' in warm state
dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
DVB: registering new adapter (Terratec Cinergy HT USB XE)
DVB: registering adapter 0 frontend 0 (DiBcom 7000PC)...
xc2028 1-0061: creating new instance
xc2028 1-0061: type set to XCeive xc2028/xc3028 tuner
xc2028 1-0061: Loading 80 firmware images from xc3028-v27.fw, type: xc2028 firmware, ver 2.7
Registered IR keymap rc-dib0700-rc5
input: IR-receiver inside at USB DVB receiver as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/rc/rc0/input0
rc0: IR receiver inside an USB DVB receiver as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4/rc/rc0
dvb-usb: schedule remote query interval to 50 msecs.
dvb-usb: Terratec Cinergy HT USB XE successfully initialized and connected
usbcore: registered new interface driver dvb_usb_dib0700

Installation of tvheadend

tvheadend is a software that controls the DVB-Stick and provides the stream of the respective channel in the network. There is also an electronic program guide (EPG), the possibility to time recordings (only useful if a hard disk is connected to the Raspberry Pi is connected). For Raspbian there are ready-to-use tvheadend packages that can be easily installed using aptitude: this saves you the effort of compiling from source. Is tvheadend is installed and started, you can reach it under http://:9981 the tvheadent surface.

Configuration of tvheadend

tvheadend channel scan: Selection of the area
tvheadend channel scan: Selection of the area

Before you can start using it, of course you first have to do a channel scan. Although there are region-specific defaults for the scan in tvheadend, in my case in Munich it only worked with the default value, which scans a larger spectrum.

tvheadend channel list
tvheadend channel list

In the end 33 channels were found, the superfluous ones that only refer to a media library are filtered out, so that you only get usable channels.

Using the play link you can either open the stream directly in your browser (if the VLC plugin is installed) or get a link to that particular stream which you can then open in VLC. This way you can check if the setup works correctly and if a live TV picture is transmitted.

Important: The time on the Raspberry Pi must be correct, otherwise there are problems with the electronic program guide (EPG). The simplest solution is to install ntpdate, which sets the correct date and time when the Raspberry is started (if an Internet connection is available).

tvheadend with DVB-C and DVB-T tuner

tvheadend with two tuners on Raspberry Pi: running.
tvheadend with two tuners on Raspberry Pi: the small computer is reaching its limit, but it works.


tvheadend is able to address several tuners. This offers several advantages: on the one hand, two clients can independently receive a different program (or you can record a different channel), on the other hand, reception weaknesses can be compensated (in my case, the channel DMAX over DVB-C works rather poorly, but over DVB-T it works without problems. The setup is simple: simply configure both DVB sticks, mapping the desired channels to the one you want to receive them from. The clients don't get anything from this but only a continuous channel list.

At first I was a bit skeptical that the Raspberry Pi could handle two demanding USB devices, but overclocked to 900 MHz this seems to be no problem. Also the parallel streaming to iPhone and iPad with two different channels works like this.

Clients for tvheadend

VLC as tvheadend client
VLC as tvheadend client

If you are using Windows, you can use a Plugins upgrade the support for tvheadend. Alternatively, XBMC can be used (e.g. also on a Android TV box like my ATV1200), a corresponding manual if you have set up tvheadend can be found for example here. XBMC can also run directly on the Raspberry so that a live TV picture is then output via the HDMI output.

For iOS devices I use the app Black Boxwhich, at 5.99 euros, is not one of the cheapest, but works together with tvheadend without any problems.

DVB-C with tvheadend: RTL in Munich

DVB-T and DVB-C simultaneously, streamed via tvheadend from Raspberry Pi
DVB-T and DVB-C simultaneously, streamed via tvheadend from Raspberry Pi

With the help of a Sundtek MediaTV Pro III is also DVB-C Support possible. On the one hand, this solves the problem that there is too long a distance between the cable termination and the TV set and that there are no suitable cables, and on the other hand, you will then again receive the channels of the RTL group in the Munich area. Since the Raspberry Pi does not have to display a video image itself but only passes on the information, the performance is sufficient for this. Somewhat surprising: it works both DVB-T and DVB-C in parallel with two USB sticks on the Raspberry Pi, you can even stream two channels simultaneously.

Apart from that, the solution already works very well, even though DVB-T is of course available in the other rooms without any problems - my first concern was to get a working setup. This was also possible without the Raspberry Pi clearly overclocked to have to.

For those who want even more power for their home server or who want to run other services, this post is recommended: . Tvheadend runs on the Cubietruck just like on the Raspberry Pi, just doesn't use as much CPU power (but a bit more power).

Update 09/08/2014:
The FireTV box from Amazon should also support XBMC, anyway there is already a Instructions to that. FireTV with XBMC sounds like a good combination for a HTPC client, which can also act as a TV client for tvheadend. I will continue to follow this topic here in the blog in the future.

[amazon box="B07ZV9C6QF"]

25 comments

  1. Hey, what is your experience with DVB-S2? At the moment I heard rather negative things because the USB port is not designed for continuous operation. Low-budget has just become noticeable in the SD card reader and USB port.

    Apart from that, thanks for the suggestions, I hope to be able to set up my Pi as a video recorder and streaming device soon.

    Greetings
    Andreas

    1. With DVB-S2 I haven't tried it yet due to the lack of a satellite dish - but depending on when the corresponding stick is delivered I will try DVB-C in 2013, which should have similar data rates.

      I already had the pi - otherwise you can do this with any other machine running Debian.

      1. First of all thanks for the great manual! I have the question in advance, are there other alternatives for DVB-C to the Sundtek MediaTV Pro III in combination with a Pi? You are talking about e.g. "2013 DVB-C", what exactly is that?

        1. Oh, this is probably a bit misunderstood: at the time of this comment I didn't have the DVB-C stick yet, the 2013 referred to the fact that I wanted to try it before New Year's Eve.

          Another USB stick that supports both DVB-C and Linux without any problems and additionally offers good support is not known to me now, I also had to search for the Sundtek part first.

          But it runs really smoothly.

          1. Now I got it, thanks for the quick answer!

            Currently I have raspbmc running, would tvheadend run properly with it too? This is also based on Debian but might be more memory intensive with the XBMC.

            If not, there is the option to install raspbian as a second OS and you can choose what to boot from PI when it boots?

            I want to use tvheadend mainly for recording, streaming is just nice to have for me.

          2. With NOOBS (http://www.raspberrypi.org/downloads) you can install different Distris in parallel (if the SD-Card is big enough).

            What you also need in any case, if the Pi should output the video directly: the MPEG-2 codes: http://www.raspberrypi.com/ (otherwise the hardware decoder is not used).

            If you have a DVB-T stick you could just try it out to see if tvheadend and Raspbmc work properly at the same time. But it should actually work.

          3. The idea with the DVB-T stick is good, I still have one of these somewhere. I'll test it with it first. NOOBS sounds good, too, if it doesn't work properly with Raspbmc. I have already activated the keys.

            Thanks for the top advice, I will report after my first attempts.

          4. Worked great with the DVB-T stick! Now I will buy the Sundtek.

            High praise to the great manual!

          5. Yes, the Sundtek stick is just as easy to set up (even a bit easier because you don't have to search for the driver). But the setup is identical for tvheadend.

          6. Hello. I'm relatively new to the subject, so a question to start with. So the Sundtek stick mentioned above works fine with DVB-C and the Pi? I want to connect it to the Pi (with USB hub) and enjoy LiveTV on TV via the Pi. Is this possible as I understand it according to the blog?

            Do I have to pay attention to something - like overclocking or something like that?

            Thanks for your help.

          7. YES - I use it so that the Raspberry Pi runs with tvheadend and does not play the program directly, but streams it to other devices on the network. Theoretically, the Pi could do both at the same time, but then only with purchased codecs and overclocking - streaming itself is already quite busy. So you need two Raspberry Pi, so that you can use all advantages.

  2. Hi, I'm currently trying to get the terratec cinergy ht usb xe running on a raspberry. However, linux is only successful with the download, after that he is missing the xc3028-v27.fw file. This keeps the stick in cold state and makes it impossible to select it in tvheadend. Anybody got an idea?

    moriz greeting
    Rasbian Wheezy
    kernel 3.10

    1. So you downloaded the .fw file? Did you also copy it to the appropriate directory (/lib/firmware)? The system can only load the file from the directory.

      1. That's one step further. Got the stick working without problems with sudo apt-get install firmware-linux-nonfree. The stick is also recognized in TVHeadend without an active hub. Does not find any services. If I put an active hub in between, the stick is not found in TVHeadend anymore.

        1. Did you at least restart tvheadend after plugging into the active hub? tvheadend only recognizes the sticks when restarting.

          1. Yep, rebooted from scratch. It doesn't recognize the stick when it's attached to a hub. Tried three hubs now.

  3. Hello, great thing with the low cost Raspi and DVB stick via TvHeadend in the entire home network TV to distribute. I am on the last hurdle to get TVHeadend via DNLA on my Smart TV. LIve stream does not work (so far) In the www I read that you have to create the channel list manually and then make it available via DNLA.
    Have you been able to gain some experience in this area and a few tips ?

    Greetings Tom

    1. Hm, I haven't tried that yet - use XBMC on an Apple TV 2 as a client. Didn't know that you can also do this with DLNA - when I get the chance I will have a look at TVHeadend and DLNA.

  4. Does the whole solution work for HD channels and DVB-C? Can they also be recorded smoothly?

    Many thanks 😉

    1. I'd have to try that out - but if I did, it would only work for the ÖR, who broadcast HD without encryption. It won't work for the private stations with encryption.

Leave a Reply

Your email address will not be published. Required fields are marked *