Raspberry Pi OpenELEC PVR (DVB-T)

Raspberry Pi Logo

I’m a proud owner of Raspberry Pi, and I hope to have much time to spend doing software / hardware stuff with it.

However this post is about my will to see RaspberryPi as mediacenter: mounting my network shares and streaming DVB-T channels. I live in Portugal, so DVB-T channels are encoded in H264/AAC.

I’ve bought this DVB-T USB device on ebay because it’s cheap (no intended advertisement).

Connecting it to RaspberryPi and doing lsusb:

$ lsusb
Bus 001 Device 004: ID 048d:9135 Integrated Technology Express, Inc. Zolid Mini DVB-T Stick

This device is Version 2, so according to LinuxTV Wiki to be support you would need to use at least Kernel 3.4 (no alarm here!) .

Let’s go build OpenELEC with PVR support and kernel support for most DVB-T USB devices (mostly taken from here).

Update #1: Steps 1 to 8 performed on my laptop using Ubuntu 12.04 on VMWare Player.
Update #3: Step #3 and #4 aren’t needed anymore. I tested the latest r12431 and DVB-T device is recognised and running.

1) First you need to have some packages installed (I used Ubuntu 12.04)

$ sudo apt-get install g++ git nasm flex bison gawk gperf autoconf automake m4 cvs libtool \
byacc texinfo gettext zlib1g-dev libncurses5-dev git-core build-essential xsltproc libexpat1-dev zip \
autopoint xfonts-utils libxml-parser-perl libproc-processtable-perl default-jre

2) Cloning OpenELEC project

$ git clone git://github.com/OpenELEC/OpenELEC.tv.git

We need Stefan Saraev OpenELEC media_build support so let’s create a temporary directory:

$ mkdir temp
$ cd temp
$ git clone https://github.com/stefansaraev/OpenELEC.tv.git
$ cd OpenELEC.tv

3) Pull that commit that really interest us!

$ git cherry-pick 3f6b9aa
$ git pull origin media_build

$ cp -R packages/linux-drivers/media_build/ ../../OpenELEC.tv/packages/linux-drivers/
$ cp tools/mkpkg/mkpkg_media_build ../../OpenELEC.tv/tools/mkpkg/
$ cd ../..
$ rm -rf temp

4) Editing RaspberryPi project options (use your favorite text editor, i used nano)

$ cd OpenELEC.tv
$ nano projects/RPi/options

Search for ADDITIONAL_DRIVERS and replace this line:
ADDITIONAL_DRIVERS=”$ADDITIONAL_DRIVERS AF9035 A867 aver_h826d RTL2832 hdhomerun-driver vtuner-driver”
with this:
ADDITIONAL_DRIVERS=”$ADDITIONAL_DRIVERS media_build”

5) Fix media_build compile error
(Use your favorite text editor, once again)

$ nano packages/linux-drivers/media_build/build

Add:
LDFLAGS=””

Before:
make VER=$VER SRCDIR=$(kernel_path) -C linux/ download

6) Compile time! It will take a while, go grab a coffee, watch some tv or read a book!

$ PROJECT=RPi ARCH=arm PVR=yes make release
Update #2: Add -j # to the above command (# is number of cores of your CPU or VM CPU), to speed up compiling time. (Thanks to azbest_hu!)

7) Format sdcard and create system 

Extract OpenELEC_PVR-RPi.arm-devel-*.tar.bz2 and execute (my sdcard is mounted on /dev/sdb . check yours!):

$ ./create_sdcard /dev/sdb
$ umount /dev/sdb1 && umount /dev/sdb2

8) Create Tvheadend add-on or install it from Addons menu

We’ve built XBMC for Raspberry Pi with PVR enabled and media support now it’s time to build TVheadend add-on which will render DVB-T channels.

(on OpenELEC.tv)
$ PROJECT=RPi ARCH=arm PVR=yes ./scripts/create_addon hts-tvheadend

When it’s finished you’ll have on target directory addons/2.1/RPi/arm/service.multimedia.hts-tvheadend . Copy this directory to OpenELEC Download network share.

9) Install Tvheadend add-on

On XBMC go to Add-on -> Install from zip file -> Home folder -> Download and select service.multimedia.hts-frontend-X.X.X.zip .

When done, reboot!

10)  Configure Tvheadend

After Raspberry Pi rebooted go to your PC browser and enter http://rpi-ip:9981

Go to Configuration -> TV Adapters . Select your DVB-T USB Device and go to Multiplexes.
Click on “Add mux(es) manually…” and add your DVB-T frequency (mine’s 754000KHZ). Leave all the rest on Auto. Click on Save changes.
Go to Services and introduce manually channel’s name and click on Save Changes.

You now have configured your channels!
Check at Channels tab.

11) Add Tvheadend to Videos

To add your channels to XBMC go to Videos -> Files -> Add videos -> Browse -> Zeroconf -> Tvheadend . Add them to Favorites if you want to.

12) Watch TV!

Easy huh? :]

_____________________________________________
P.S.: I wouldn’t done this without Stefan Saraev help, thank you!

About these ads

133 Comments

Filed under Tech

133 responses to “Raspberry Pi OpenELEC PVR (DVB-T)

  1. Interessante, agora deste-me umas boas ideias. E vou ter mesmo que experimentar isto! Acabei de mandar vir essa PenUSB do Ebay e tudo ;)

    Será que não podes meter na Dropbox o System/Kernel dessa versão compilada já com PVR. Seria mais facil para eu fazer o update…

  2. Great tutorial. There is an unnecessary “make” in command at step 6, it shoul be:
    $ PROJECT=RPi ARCH=arm PVR=yes make release
    And for some speedup you may add “-j X” to the end, where X is the numer of cpu cores in your machine.

  3. Raul Silva

    Foi nisto que pensei logo da primeira vez que ouvi falar no Raspberry Pi!
    Agora estou mesmo tentado a comprar um!!
    O que utilizas para controlar (remote control) o OpenELEC ?

    • Neste momento e porque é uma TV já com algum tempo estou a utilizar o XBMC Remote (iPhone/Android). Também estou a testar a possibilidade de usar o PS3 BD Control. Em televisões mais modernas (suporte CEC) basta ligar o RPi e usar o comando da TV (já testei e funciona a 100%).

  4. Raul Silva

    Já encomendei o meu, agora apercebi-me que tenho de ter um pc com linux para instalar o OpenELEC… Não dá para fazer isso a partir do windwows?
    Em relação ao comando, lembrei-me que tenho um comando usb com a norma X10 da Marmitek, será suportado?

    • Mesmo tendo a versão final compilada necessitas de um ambiente linux, podes tentar cygwin, mas penso que podemos utilizar virtualbox e instalar-lhe Ubuntu.

      Quanto ao comando ainda não vi ninguém a tentar nenhum desses, é uma questão de tentares veres como é reconhecido (comando: lsusb) e ver o log do sistema quando introduzes no usb, comando tail -f /var/log/syslog , antes de introduzires a pen.

  5. Thanks for the great tutorial. I bought the same DVB-T adaptor just to try this out.

    I got as far as step 10 (using r11785 and v2.1.3 of the tvheadend addon). Sadly nothing is shown in the Select TV Adaptor drop down on the Configuration->TV Adaptors screen. The tuner is showing up as you describe above when I do lsusb, and I can see that media_build made it to /lib/modules/3.2.26/updates/media_build

    Any thoughts on how I can troubleshoot this?

    PS One tiny correction – at step 8 s/script/scripts

    • Hi Chris and thanks!

      I’ve had that problem myself but i don’t remember exactly what i did. Try to change USB port on which you connect DVB-T adaptar and reboot RPi. I’ll reproduce all steps to see if i forgot something! I’ll report later.

      Thanks for the correction, i’ve updated it!

      • I already tried changing ports and numerous hot and cold reboots. I even tried using different browsers for the head end addon just in case it was some weird client side issue with the dropdown.

        It seems that I might have got a different version of the USB adaptor than you (despite ordering from the same eBay seller). Looking at the LinuxTV Wiki suggests that I have the version 1 device rather than version 2, which means I need to be using a different firmware. I’m guessing that I don’t need the media_build stuff at all (though it’s hard to see what harm it’s doing as the dvb-usb-it9135-01.fw is there in /lib/firmware and the two required modules are present too).

        If I look in dmesg I see this:

        [ 2.345267] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
        [ 2.447379] usb 1-1.2: New USB device found, idVendor=048d, idProduct=9135
        [ 2.447421] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0

        There’s no obvious sign of the it913x drivers and firmware being loaded. What do you see in the dmesg of your working system?

      • I got it working by doing a build without media_build, and by not having anything else plugged into the RPi USB (I suspect power drain might be at the edge of the RPi’s ability, but I don’t have a USB2 powered hub handy).

        For anybody else that’s troubleshooting here’s what I get from dmesg | grep 913:

        [ 2.538364] usb 1-1.3: New USB device found, idVendor=048d, idProduct=9135
        [ 8.847536] it913x: Chip Version=02 Chip Type=9135
        [ 8.848670] it913x: Dual mode=0 Tuner Type=38
        [ 8.848693] it913x: Unknown tuner ID applying default 0×60
        [ 8.871365] dvb-usb: found a ‘ITE 9135 Generic’ in cold state, will try to load a firmware
        [ 11.821312] dvb-usb: downloading firmware from file ‘dvb-usb-it9135-02.fw’
        [ 11.821981] it913x: FRM Starting Firmware Download
        [ 13.323878] it913x: FRM Firmware Download Completed – Resetting Device
        [ 13.358502] it913x: Chip Version=02 Chip Type=9135
        [ 13.359072] it913x: Firmware Version 52887808
        [ 13.457635] dvb-usb: found a ‘ITE 9135 Generic’ in warm state.
        [ 13.476298] DVB: registering new adapter (ITE 9135 Generic)
        [ 13.620279] it913x-fe: ADF table value :00
        [ 13.637434] it913x-fe: Crystal Frequency :12000000 Adc Frequency :20250000 ADC X2: 01
        [ 13.776990] it913x-fe: Tuner LNA type :60
        [ 14.246600] DVB: registering adapter 0 frontend 0 (ITE 9135 Generic_1)…
        [ 14.247505] IR keymap rc-it913x-v1 not found
        [ 14.262604] dvb-usb: ITE 9135 Generic successfully initialized and connected.
        [ 14.262619] it913x: DEV registering device driver
        [ 14.263028] usbcore: registered new interface driver it913x

      • Hi Chris! Sorry for the delayed answer, but i’ve tested everything like you and i think it might be a power drain. On your latter comment the dmesg output is too small, it has to be detected as dvb-usb like it is now! and firmware used is dvb-usb-it9135-02.fw and not 01. I suspect that 11785 as already media_build built-in. I’ve to try, but 11785 keeps giving me an error on first boot “Error: on prepare sys_root: Cannout mount /flash/SYSTEM”.

      • 11785 doesn’t include media_build, but that doesn’t matter to me as I have the v1 device, which is already supported without media_build.

        The other thing I noticed in dmesg with 11785 is:

        dvb_core: version magic ’3.2.24 preempt mod_unload ARMv6 ‘ should be ’3.2.26 preempt mod_unload ARMv6 ‘

        I think at 11692 they upgraded the kernel from 3.2.24 to 3.2.26, and this might be complaining about media_build causing a version mismatch.

  6. MiZ

    HI,

    media_build was removed from stefansaraev/openelec ?

    I can’t find it ?

    • Hi!

      No, it’s on branch media_build but with cherry-pick it’s enough to get it.

      • MiZ

        Hi,

        ” git cherry-pick 3f6b9aa
        fatal: ambiguous argument ’3f6b9aa’: unknown revision or path not in the working tree.
        Use ‘–’ to separate paths from revisions

        ubuntu 12.04 take this error ?

    • I’ve never seen that error before. Try to remove the directory and clone again. Look my output from ubuntu 12.04:

      tpires@vm-blade:~/Documents/temp$ git clone https://github.com/stefansaraev/OpenELEC.tv.git
      Cloning into ‘OpenELEC.tv’…
      remote: Counting objects: 96196, done.
      remote: Compressing objects: 100% (29511/29511), done.
      remote: Total 96196 (delta 63710), reused 95648 (delta 63302)
      Receiving objects: 100% (96196/96196), 134.49 MiB | 635 KiB/s, done.
      Resolving deltas: 100% (63710/63710), done.
      tpires@vm-blade:~/Documents/temp$ cd OpenELEC.tv/
      tpires@vm-blade:~/Documents/temp/OpenELEC.tv$ git cherry-pick 3f6b9aa
      [master 17a3e3e] new package: media_build
      Author: Stefan Saraev
      4 files changed, 147 insertions(+)
      create mode 100755 packages/linux-drivers/media_build/build
      create mode 100755 packages/linux-drivers/media_build/install
      create mode 100644 packages/linux-drivers/media_build/meta
      create mode 100755 tools/mkpkg/mkpkg_media_build

      • MiZ

        Ok, THX, when remove the directory and clone again i’ts works.

        But when i compile i’v got error

        scripts/get: 178: /home/michalz/komp/src/OpenELEC.tv/projects/RPi/options: media_build”: not found
        INSTALL libftdi
        scripts/install: 178: /home/michalz/komp/src/OpenELEC.tv/projects/RPi/options: media_build”: not found
        packages/devel/libftdi/install: 178: /home/michalz/komp/src/OpenELEC.tv/projects/RPi/options: media_build”: not found
        packages/devel/libftdi/install: 178: /home/michalz/komp/src/OpenELEC.tv/projects/RPi/options: media_build”: not found
        make: *** [release] error 127

        How enable debug when compile ?

      • Please copy paste exactly how’s your line in projects/RPi/options . Have you copied the tools/mkpkg/mkpkg_media_build too ?

  7. MiZ

    Hi,

    options file – http://pastebin.com/zRQtuChK
    full log output – http://pastebin.com/RSpH5R7m
    And file
    ls tools/mkpkg/mkpkg_media_build
    tools/mkpkg/mkpkg_media_build

    • There’s def something wrong with your options file, when i compile misc hardware configuration looks like this (it has media_build as included driver!):

      Misc. hardware configuration:
      ======================================================
      – ALSA support: yes
      – Pulseaudio support: no
      – Blu-Ray support: yes
      – Bluetooth support: yes
      – Hardware Sensors support: yes
      – LCD drivers: irtrans,imon,imonlcd,mdm166a,MtxOrb,lis
      – Include driver: asix-ax887xx
      – Include driver: RTL8192CU
      – Include driver: media_build
      – Include driver: w_scan
      – Include firmware: misc-firmware
      – Include firmware: wlan-firmware
      – Include firmware: dvb-firmware

      • MiZ

        Hi,

        I know what was the cause of the error in the compilation.

        Is the first glance the difference in ” or ” ?

        When copying a pasting in quotes is not only a strange sign replacement due to the font used on wordpress-e :)

        Now everything is working properly.

      • Hm didn’t know that, but glad you worked that out! :]

  8. MiZ

    Hi,

    I guess I always have to be uphill.

    When you run the card resets all the time, or may be due to over current? Sometimes the card is loaded correctly, but the execution of an operation is reset and load the module again.

    I have a card with ID 048d: 9006

    I tested different files with the firmware, and always was the same symptom

    Log:

    [ 561.282617] dvb-usb: ITE 9135(9006) Generic successfully deinitialized and disconnected.
    [ 561.375197] usb 1-1.3: reset high-speed USB device number 4 using dwc_otg
    [ 561.479011] it913x: Chip Version=01 Chip Type=9135
    [ 561.479573] it913x: Firmware Version 204869120
    [ 561.481104] it913x: Remote HID mode NOT SUPPORTED
    [ 561.481844] it913x: Dual mode=0 Tuner Type=0
    [ 561.481878] dvb-usb: found a ‘ITE 9135(9006) Generic’ in warm state.
    [ 561.482322] dvb-usb: will use the device’s hardware PID filter (table count: 31).
    [ 561.486463] DVB: registering new adapter (ITE 9135(9006) Generic)
    [ 561.495501] it913x-fe: ADF table value :00
    [ 561.500145] it913x-fe: Crystal Frequency :12000000 Adc Frequency :20250000 ADC X2: 01
    [ 561.544138] it913x-fe: Tuner LNA type :38
    [ 561.604982] DVB: registering adapter 0 frontend 0 (ITE 9135(9006) Generic_1)…
    [ 561.605501] dvb-usb: ITE 9135(9006) Generic successfully initialized and connected.
    [ 561.605533] it913x: DEV registering device driver
    [ 562.894590] dvb-usb: ITE 9135(9006) Generic successfully deinitialized and disconnected.
    [ 562.975363] usb 1-1.3: reset high-speed USB device number 4 using dwc_otg

    • Hi MiZ!

      My dvb-usb output is not similiar to that, i guess you’re using a different DVB-T USB device, what fw file is it using?

      If you do “modinfo it913x-fe” what is the output ?

      • MiZ

        Hi,

        driver load – dvb-usb-it9135-01.fw ( and diffrent dvb-usb-it9135-01.fw found on google )

        and i try
        dvb-usb-it9135-02.fw

        root ~ # modinfo it913x-fe
        filename: /lib/modules/3.2.26/updates/media_build/it913x-fe.ko
        license: GPL
        version: 1.15
        author: Malcolm Priestley tvboxspy@gmail.com
        description: it913x Frontend and it9137 tuner
        srcversion: 533BB7E5866E52F63B9ACCB
        depends:
        vermagic: 3.2.26 preempt mod_unload ARMv6
        parm: debug:set debugging level (1=info (or-able)). (int)

      • It should automatically load dvb-usb-it9135-02.fw, if the device is the same.

        I guess the correct version of the it913x-fe it’s 1.28.

        Try to delete the linux and image folder inside the build folder and recompile it again. Media_build is loaded into kernel updates so it overrides its modules without the need to be updated.

  9. wolfPi

    hi,
    great tutorial,
    will this work only with the usb dongle you used? or should it work on all the ones that were found to be compatible with the RPi? http://elinux.org/RPi_VerifiedPeripherals#USB_TV_Tuners_and_DVB_devices

    • Hi!

      Thanks :] Current OpenELEC kernel version is 3.2.24, so if you’re choosing an USB device that’s supported since, like let’s say, 2.6.x then you just need to do with PVR=yes. You don’t need the media_build part.

  10. Geno

    Wait a sec.. I’m confused and I don’t know if I got you right. Was you able to play live stream on RPi itself?

    • Hi there! Yes, the concept may lead to some confusion but tvheadend works this way: it has a backend who “reads” from the USB device and serves it as a streaming server. So with a VLC from the computer or within XBMC you can play it as live stream.

      • Geno

        Thanks for explanation. I guess you’ve tried to play it on XBMC. Was the video smooth, with no freezes?
        Btw. Great tutorial. Keep up good work :)

      • Yes the video is smooth as the breeze and no freezes at all.

        Thanks.

      • When you say you have TV playing in XBMC is that on the RPi or some other device (and if it is the RPi is it the one attached to the DVB device or another one)?

        The best I’ve managed so far on the RPi is to get sound playing, which is no surprise given that MPEG-2 playback is only just becoming possible. I’ve had no trouble at all playing video streams in the VLC plugin on a remote PC, though it’s hard to find players that will cope nicely with MPEG-2 in the .mkv container for recorded content (probably best to convert to MPEG2 TS and then transcode to something more modern/efficient)

      • Hi Chris!

        When i really play DVB-T channels on the RPI (the one with the dongle attached). Concerning MPEG-2 RPi have just released a license which enables you to decode MPEG-2.

      • Now that I have an MPEG2 codec license I can watch live streams and recordings on my RPi, but I’m curious how you had live playback working before the MPEG2 licenses became available?

      • In Portugal all DVB-T channels are encoded with H.264/AAC.

  11. jbaiao

    Boa tarde.
    Parabéns por este espectacular tutorial!!!
    Tenho acompanhado este projecto e decidi testar. Não tenho muitos conhecimentos mas lá coloquei mãos à obra.
    Como é necessário linux, montei uma maquina virtual com o Ubuntu 12.04.
    Correu tudo bem até ao ponto “8) Create Tvheadend add-on”.
    Aparece-me o seguinte erro:
    “Cant’t get hts-tvheadend sources : http://sources.openelec.tv/devel/hts-tvheadend-78213a0.tar.xz
    Parece-me que o site está down. Acontece o mesmo a mais alguém?

    Amigo “tpires”, o ficheiro do teu dropbox já contém este addon?

    Obrigado pela ajuda.

    • Viva e obrigado,

      O servidor em que o OpenELEC tem hospedado tanto o código como a página está em baixo mas deixo aqui um link para o plugin tvheadend já compilado.

      • jbaiao

        Bem me parecia.
        Muito obrigado tpires.
        Agora só falta testar.

      • jbaiao

        Preciso de mais uma ajuda.
        Estou a tentar copilar tudo desde o inicio numa máquina virtual em ubuntu 12.04. Aparece-me o seguinte erro:

        ./scripts/rmmod.pl check
        Can’t locate Proc/ProcessTable.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./scripts/rmmod.pl line 4.
        BEGIN failed–compilation aborted at ./scripts/rmmod.pl line 4.
        make[2]: *** [default] Error 2
        make[2]: Leaving directory `/home/jose/OpenELEC.tv/build.OpenELEC_PVR-RPi.arm-devel/media_build-6679a70/v4l’
        make[1]: *** [all] Error 2
        make[1]: Leaving directory `/home/jose/OpenELEC.tv/build.OpenELEC_PVR-RPi.arm-devel/media_build-6679a70′
        make: ** [release] Erro 2

        Sabes como posso resolver?
        Agradeço desde já a tua ajuda.

      • jbaiao

        Após algumas pesquisas faltava actualizar o ubuntu.
        Agora estou com outro problema.
        Na compilação chego ao seguinte ponto e não passa daqui:

        –2012-08-29 10:22:34– ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.25.tar.bz2
        => `sources/alsa-lib/alsa-lib-1.0.25.tar.bz2′
        Resolving http://ftp.alsa-project.org (ftp.alsa-project.org)… 77.48.224.243
        Connecting to http://ftp.alsa-project.org (ftp.alsa-project.org)|77.48.224.243|:21… connected.
        Logging in as anonymous … Logged in!
        ==> SYST … done. ==> PWD … done.
        ==> TYPE I … done. ==> CWD (1) /pub/lib … done.
        ==> SIZE alsa-lib-1.0.25.tar.bz2 … 838403
        ==> PASV … done. ==> RETR alsa-lib-1.0.25.tar.bz2 …

        Alguém sabe porquê?
        Obrigado pela vossa ajuda.

      • Viva, peço desculpa por não ter respondido ao outro comentário.

        Neste comentário não vejo nenhuma mensagem de erro que ajude à resolução do problema. Talvez no ficheiro config.log tenha algo mais.

      • You need to install libproc-processtable-perl (sudo apt-get install libproc-processtable-perl). Had the same issue on Ubuntu 12.04 Desktop and my complete apt-get for this dist is: “sudo apt-get install g++ nasm flex bison gawk gperf autoconf automake m4 cvs libtool byacc texinfo gettext zlib1g-dev libncurses5-dev git-core build-essential xsltproc libexpat1-dev zip autopoint xfonts-utils libxml-parser-perl default-jdk libproc-processtable-perl”

  12. Pingback: Raspberry Pi TV/PVR « Chris Swan's Weblog

  13. The Cageybee

    Many thanks for the instructions. I’d never have figured this out myself!
    A quick question though. In step 8) “Create Tvheadend add-on” do I perform this step on the rPi or still in the Ubuntu VM?

    Cheers,
    The Cageybee

  14. Thanks for the nice guide, very clear and good to follow. I got through to step 8, where the tvheadend addon is compiled. At the moment I’m getting an error stating:
    “build.linux/bundle.c:45165:1: error: expected expression at end of input
    make: *** [build.linux/bundle.o] Error 1″
    To me it seems like some setting in some config file is causing this, but I’m not sure. Any ideas on why this might be happening?

    • Some more info after putting the files back from the SRC;
      Traceback (most recent call last):
      File “/home/user/OpenELEC.tv/build.OpenELEC_PVR-RPi.arm-devel/hts-tvheadend-7630970/support/mkbundle”, line 152, in
      idx = add_entry(ents)
      File “/home/user/OpenELEC.tv/build.OpenELEC_PVR-RPi.arm-devel/hts-tvheadend-7630970/support/mkbundle”, line 131, in add_entry
      tmp = add_entry(ents[k], d, k, idx, p)
      File “/home/user/OpenELEC.tv/build.OpenELEC_PVR-RPi.arm-devel/hts-tvheadend-7630970/support/mkbundle”, line 125, in add_entry
      output_file(d, k, idx+1, p)
      File “/home/user/OpenELEC.tv/build.OpenELEC_PVR-RPi.arm-devel/hts-tvheadend-7630970/support/mkbundle”, line 69, in output_file
      d = open(p, ‘rb’).read()
      IOError: [Errno 21] Is a directory: ‘/home/user/OpenELEC.tv/build.OpenELEC_PVR-RPi.arm-devel/hts-tvheadend-7630970/data/dvb-scan’
      make: *** [build.linux/bundle.c] Error 1

      • Ok, I found the problem in the meantime.
        CURL is a dependancy to get tvheadend’s scan data files, but I didn’t have the CURL package installed. (cfr https://www.lonelycoder.com/redmine/issues/1166)

      • Hi and sorry for my late answer,

        Glad you work that out ;-)

      • Geno

        How did you solve the problem? I’ve installed CURL but I keep getting error:
        build.linux/bundle.c:45922:1: error: expected expression at end of input
        make: *** [build.linux/bundle.o] Error 1

      • Geno

        When I opened “build.linux/bundle.c” file and jumped to line 45922, it seems like something is missing here. 45922 is the last line of this file and it looks this way “static const uint8_t filebundle_data_000053[] = {”
        So it’s beginning of some kind of declaration but it’s not finished. What the…? Can you guys tell me if this looks the same in your case?

      • Geno

        I figured it out :)
        I downloaded the latest dvb-apps scan files manually http://linuxtv.org/hg/dvb-apps/archive/tip.tar.bz2 and put it in the “hts-tvheadend-7630970/data/dvb-scan” location. It seems like there’s something wrong with ‘getmuxlist’ script.

      • Sorry for not help you sooner, but i’ve been busy lately.

        With that “update” to dvb-scan you’re able to compile tvheadend plug-in?

      • Geno

        No problem :)

        Yes, downloading those files to dvb-scan allowed me to finish compilation of that plug-in successfully. I guess that I have done what ‘getmuxlist’ script is supposed to be doing (getting files, unpacking, moving them to the proper location).

  15. Hello, i builded the openelc with the PVR support, but in my XBMV i dont have any PVR Options on the PI.

  16. Alberto

    also this package needs to be installed in order to compile
    sudo apt-get install libproc-processtable-perl

  17. stickypl

    Hi
    Thanks for this, it was very useful indeed. I’ve subsequently been trying to research compiling and adding a Mediaportal add-on to the setup, rather than the TvHeadend, as I have a Mediaportal Server. Do you think that would this be possible?

    regards

  18. ldidi

    LD_FLAGS=”” is not more needed since a commit fixed it.

    Plus, “libproc-processtable-perl” is required for media_build to build. Otherwise, it will raise an error: Can’t locate Proc/ProcessTable.pm.
    Install it with apt-get install libproc-processtable-perl.

  19. Geno

    I finally manage to get all that stuff working but I got few more issues.

    1) My live tv stream is freezing from time to time, but it’s probably due to my outdoor broadband antenna which gather a lot of noise. However, I got cheap STB connected to my TV and with the same antenna plugged in the view is way better than on OpenELEC with USB tuner. Well, STB probably contains some electronic system which enhance source signal quality. Anyway, I will try my usb tuner with a directional antenna at my cousin’s house to make sure that it’s signal quality issue.
    Btw. What kind of antenna are you using?

    2) I got channels which come from two different MUX’es. When I switch between channel from MUX-1 to channel from MUX-2, XBMC shows “working…” message which lasts forever and it finally freezes the system. Any idea about this one?

    3) All my tests was done using tvheadend HTSP Client. I wanted to try another PVR client but when I enabled one of them I was keep getting “No PVR clients has been started yet” message. What did i do wrong? Is there any additional configuration required?

  20. Hi

    I’ve got part way through however I’m recieving an error as below

    paulselby1@linux:~$ git cherry-pick 3f6b9aa
    fatal: Not a git repository (or any of the parent directories): .git

    Any ideas ? Thanks once again !

  21. Hcorreia

    Tiago, desculpa a minha ignorância mas será que esse receptor consegue receber dvb-c ou seja cabo terrestre (Zon). A minha ideia era que o RPI funcionasse como uma box da zon (a ideia não é “descodificar” canais, apenas ver e gravar os canais livres). É possivel? Abraço e continua com este projecto.

  22. stickypl

    Hi
    I previously got this to compile okay but was trying it again, re-downloading everything from git, and received the following error:

    unrecognised emulation mode: tune=arm1176jzf-s
    Supported emulations: armelf_linux_eabi armelfb_linux_eabi

  23. Pingback: Der Raspberry Pi Thread - Seite 24

  24. Hi, I got the same problem. Did you find a solution
    Bes Regards
    Sune

  25. Willy1009

    hi, when i try to compile OpenELEC i get this error

    SyntaxError: Non-ASCII character ‘\xc3′ in file build/temp.linux-i686-2.7/libffi/fficonfig.py on line 35, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

    i don’t understand what’s wrong. Thank’s for your help.

  26. Willy1009

    hi,

    i get this error during compilation of OpenELEV :
    SyntaxError: Non-ASCII character ‘\xc3′ in file build/temp.linux-i686-2.7/libffi/fficonfig.py on line 35, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

    I try to google it but i can’t find solution, can you help me ?

    • Hi!

      I’ve never seen that error before. Try to do a clean and make this again

      1.
      $ PROJECT=RPi ARCH=arm PVR=yes ./scripts/clean

      2.
      $ PROJECT=RPi ARCH=arm PVR=yes make release

      • Willy1009

        i get the same error.
        When i change encoding in python fil that’s work but i get this error with another file.

        strange….

      • That’s quite awkward.. Yesterday, i’ve rebuilt my OpenELEC (from stratch) and i didn’t noticed any error like that. Although i’ve modified step #3.

    • overlord

      Hi,
      Got the same error, “SyntaxError: Non-ASCII character ‘\xc3′ “.
      Fixed it with moving the building location to a ASCII compatible one.
      The problem is that the python files don’t have the “# -*- coding: utf-8 -*- ” code line and so if you have a “Ä,Ö,Ü,…” in the building path it doesn’t work!
      e.g: /home/build/Arbeitsfläche/OpenELEC.tv/ doesn’t work

  27. Beach

    Great guide!
    Are you sure in step #4 to replace the line and not add the line? I am getting errors that ADDITIONAL_DRIVERS are not found. Will try again with the line added and not replaced. (takes half a day)

    • Beach

      Guess I sorted it out, spaces are not allowed between ADDITIONAL_DRIVERS = “media_build”
      Should be
      ADDITIONAL_DRIVERS=”media_build”

      However, the latest options file does not contain a default value for ADDITIONAL_DRIVERS. So in my opinion the …=”$ADDITIONAL_DRIVERS media_build” should be …=”media_build”

      Got it compiling again. Takes half a day (Pentium4)

  28. sebus

    Also depending what version of U 12.04 was used for install
    (I use the mini version from
    http://athlon1900.dyndns.tv/OsirisCS-Ubuntu12/Allgemeines/Ubuntu_12.04_X86_mini.iso

    One might also need to install java:

    sudo apt-get install default-jdk

    • Thanks for your feedback. I don’t think it’s due to your version, but rather OpenELEC distro has added some software that use java. I’ll add that package to the how-to.

  29. sebus

    r11955 following above instructions did not finish as a success for me.
    The system was built fine (OpenELEC-RPi.arm-devel-20120921210519-r11955.tar.bz2 created), but can not install any addons, so something must have gone wrong on the way…
    Your OpenELEC-RPi-PVR-20120909-r11904 works fine!

    sebus

  30. Pingback: Raspberry Pi OpenELEC latest PVR support (DVB-T) | Geek for a day

  31. Jose Lapao

    tpires, adorei o teu trabalho, mas estou com alguns problemas, uso a imagem já compilada retirada de http://openelec.thestateofme.com/, mas primeiro que tudo não sou capaz de usar a nossa TDT eu tenho um servidor em Linux Ubuntu 12.04 versão server sem GUI (mas não entendo nada de linux) onde esta instalado o tvheadend tenho um PC com windows e o respectivo xbmc funciona a TDT as mil maravilhas, no servidor tenho também uma skystar 2 (versão SD) e apanho também os FTA dos satélites configurados, no meu Samsung Galaxy S2 com o respectivo xbmc para android o PVR também funciona vejo a TDT e o SAT na boa, no RPI népia os nosso canais aparecem por alguns segundos e depois vai-se tudo os do satélite o TDT Espanhola nada, mas isso já sei pois descobri que é necessário comprar uma licença a Raspeberry Fundation para o MPEG2 e para o VC1 ou seja se queres ver MPEG2 e divx/xvid tens de ter as licenças que custam 3,0€ e 1,5€ respectivamente, já tentei também com a pen TDT e o tvheadend server da openelec no próprio raspberry pi e nada fica igual, não sei se podes ajudar sobre o assunto ou não, uso o comando da WII que funciona as mil maravilhas o problema é que sempre que ligo o sistema tenho de estar a sincronizar-lo não sei se um do tipo MELE F10 ficam sempre sincronizado, há outras questões que te pergunto, descobri em http://elinux.org/RPiconfig#Overclocking_options formas de fazer overclock ao RPI para que funcione um pouco melhor nos 1080p, e pela questão de em analógico o gajo só emitia em NTSC 4:3 já sou capaz que emita em PAL 16:9, mas no openelec xbmc o gajo reporta sempre os 700MHz de speed embora eu tenha feito o overclock para os 1000MHz para experimentar, é verdade que os 1080p rodam um pouco melhor, mas não muito, também descobri que se o 1080 tiver o som em AAC em vez de DTS ou AC3 o gajo roda as mil maravilhas, e que se o ficheiro for mais pequeno que 10-11 GB e é verdade eu tenho um de 12,5 GB e “engasga-se” os outros de 7-8 GB, mesmo com som DTS ou AC3 no inicio “engasga-se um pouco, mas depois a coisa parece estabilizar.
    Ou seja se pudesses ajudar na questão da TDT .h264, pois a outra não dá sem licença. agradecia.
    Na questão do overclock, pois não sei como fazer os comandos dentro do próprio openelec para ver a velocidade real do CPU.
    Queria também trocar o splash screen e o tempo de duração do mesmo, queria que tivesse sempre lá até o XBMC aparece-se o que não aconteçe.

    Obrigado

  32. Viva e obrigado,

    Ontem também tive a testar a última versão (r12431) e verifiquei que o TDT não me deu nada até que fui a Filmes->Ficheiros-> Mais.. -> Zeroconf Browser -> TVHeadend -> Canais ao Vivo e OK. Depois fui à lista criada, “Canais ao Vivo”, e seleccionei um dos canais. A partir daí os canais passaram a dar. Julgo ser algum problema relacionado com o TVHeadend. O mesmo para os canais de SAT, julgo ser mesmo um problema desta versão do TVHeadend.

    Também já tentei usar o comando da Wii ou da PS3 e tem esse mesmo problema, a cada reboot é necessário voltar a fazer o emparalhamento.

    Desde o Turbo Mode, o overclock do RPi funciona de maneira diferente. No config.txt apenas se define qual o valor máximo possível para o CPU. O próprio RPI, consoante o processamento necessário, é que vai alternar a velocidade do CPU. Para ver isso de forma mais detalhada, podes usar o comando dmesg.

    O playback do filme de 1080p está a ser feito via disco USB ou por rede?

    Cumprimentos.

  33. TPires,

    Fantástico o seu trabalho!

    Moro nos EUA e tenho um Hauppauge WinTV 950Q. O que devo fazer para incluí-lo no build? Tenho uma máquina com o Mint Linux e já consegui compilar a última versão do OpenELEC, mas essa versão não reconhece o WinTV.

    Desde já muito obrigado.

    • Viva e obrigado,
      A Hauppauge WinTV 950Q já é incluída no kernel desde a versão 2.6, mas apenas algumas distruibuições incluem o driver. O OpenELEC não deve incluir o driver com o kernel, mas irei ver se é possível compilar uma versão com o driver.

      • Tiago,

        After many tries, I was able to compile a version of OpenELEC/XBMS with support for WinTV-HVR 950Q, which is in reality the Auvitek AU8522 QAM/8VSB Frontend. I was also able to access tvheadend via the browser, but I have not being able to make tvheadend recognize my cable channels. I know that the cable channels work with the WinTV-HVR 950Q because I can see them in Windows.

        I use the option Add DVB Network by Location and it lists some locations in Canada and the US, but none work for me. I live in South Florida. Questions:
        1. What do I need to do fro tvheadend recognize my cable channels?
        2. How can add other locations to tvheadend?
        3. In the event that I am able to add other locations to tvheadend, can I use the standard frequencies that WinTV provides for Windows and use them as a tvheadend location?

        Assuming that I am able to use tvheadend with OpenELEC, I am also interested in using the raspberrypi as a tvheadend stream server. What do you recommend? Raspbian with tvheadend? How do I compile tvheadend with Raspbian?

        Any help would be deeply appreciated. Obrigado!

      • Hi!

        I’m glad you could make your device work! I believe if you know your TV frequency you can add it manually: http://rpi-ip:9981 -> Configuration->TV Adapters -> Multiplexes -> Add mux(es) manually.

        1. & 3. Try to add them manually.
        2. I’ll search for that, in the meanwhile give me your TV frequencies.

        Yes, tvheadend can be installed on Raspbian (i don’t know if by apt or compiling). I would recommend a clean “server” (no X window manager) Raspbian running tvheadend as stream server. I think it can handle up to 2~3 devices.

      • Tiago,

        Thanks for your prompt reply.
        For some reason, I cannot add muxes manually. When I Add mux(es) manually, I get a light blue box that has only an add button, nothing else and Ia ma not able to type anything on it.
        Regarding the frequencies, there is a xml file in Windows called cable.xml that has a lot of frequencies, which I suspect is used by WinTV to find the channels. How can I upload the file to you?
        Thanks again

      • Currently tvheadend add-on has been set as *broken*. I believe it’ll get some updates soon and then you can test that feature again.

      • Tiago,

        Thanks a lot. I will keep an eye for updates. Meanwhile if you find that it was updated, please let me know.

        Thanks again

  34. Kyriakos

    Hi

    I am happy to be making the 100th comment on your excellent article.

    Since my Unix skills are not that great, most of the article is “greek” to me (which shouldn’t be because i am actually Greek!), let me sum up:

    I live in Greece and we also have DVB-T channels encoded in MPEG4(H264/AAC).

    So if i:
    1. use the latest Openelec image (r12559) and install it to my Rpi
    2. Buy the same DVB-T USB Device from ebay or other IT9135-based.
    (or some other DVB-T2 dongle supported – please point me to appropriate compatibility page if you can)
    3. Install Tvheadend add-on from Addons menu in XBMC.
    (Is it included – or do i have to compile it myself?)
    4. Configure Tvheadend
    5. Add Tvheadend to Videos

    … then i can watch live DVB-T SD and HD programms from the Rpi.
    (i wished!)

    Thanks in Advance

    Kyriakos

  35. ManuSilva

    Boas!
    Tenho o serviço analógico da tv cabo (agora ZON) e gostaria de saber se é possivel utlizar como fonte de sinal o cabo rf que liga a tv em vez de utilizar o tdt.

    Cumprimentos

  36. Filipe Ribeiro

    Amigo tpires,
    Tenho uma raspbeery pi com openelec (XBMC) e quero comprar DVB para poder ver canais cabo com o TVHeadend. Pergunto, que DVB devo comprar e como configurar isto tudo. Abraço e desde já obrigado.
    Filipe R

  37. xbackagain

    Bom dia, seria possivel voltar a disponibilizar o link com a versão compilada? é que o link do dropbox já não esta activo.
    Obrigado e continuação do bom trabalho.

  38. João Rodrigues

    Ola Tiago e obrigado por tanta coisa que ja aprendi no teu blog! Entretanto ando a tentar fazer o streaming de uma entrada analogica de video. será possivel?
    a ideia é ter uma camera de vigilancia analogica e fazer streaming para ver o video no browser do pc e do tablet.

    Obrigado,
    João

    • Viva e obrigado,

      Bem é uma tarefa arriscada visto que há ou vão haver webcams para o RPi que filmam a 1080p@30fps. O dispositivo que tens de captura é USB?

      • Joao Rodrigues

        Sim a placa que pretendo utilizar é a easycap e colocar o sinal composto de video e o do som ambiente.

  39. Sascha Wüstemann

    I have followd your tutorial with Openelec XMBC 12.0-RC3 successfully.
    My Afatech AF9013 is recognized, I added multiplexes, mapped channels and everything is fine. I can choose any programm/tv-show which currently played and I can listen to the audio but there is no video. If I cahnge to fullsize it is simply black.

    Any idea what I can do to get video, too?

  40. Sascha Wüstemann

    Chris Swan, you are right, this is indeed the case. I will follow your advice and report later.
    Thanks!

  41. Hi,

    I follow the tutorial but in the “tvheadend build” step :
    PROJECT=RPi ARCH=arm PVR=yes ./scripts/create_addon hts-tvheadend

    The addon is not build and there is no .zip.
    How to resolve this problem ? Thx

  42. Sascha Wüstemann

    All of you were right, I have bought a license for mpeg decoding, installed tv-headend and were able to configure the dvb-t device with my browser.
    It works.
    Thank you all!

  43. nico

    i have a terratec cinergy dvbt xs . how my i know if openlec have the drivers? linux.tv wrote the kernel. if opnelec has an update kernel the cinergy could be recognized?

  44. Just wanted to say thank you tpires!
    your guide was definitely a great help, and I know I would never have got my DVB-T stick working without you.

    I must admit though that step 8 was by far the hardest step to understand!
    In fact I couldn’t follow it, i just installed TVheadend as an add-on after powering up the Raspberry – I would love to have followed your instructions but I could not understand the “on” OpenELECT.tv, did you mean “in” the folder OpenELEC.tv folder on my pc?
    (on OpenELEC.tv)
    $ PROJECT=RPi ARCH=arm PVR=yes ./scripts/create_addon hts-tvheadend

    When it’s finished you’ll have on target directory addons/2.1/RPi/arm/service.multimedia.hts-tvheadend . Copy this directory to OpenELEC Download network share.

    Anyway, thanks for everything, I’m really thankful for you taking the time to document what you did, for others like me to get it working.

  45. Pingback: Multimedia Services | MMCS News And Reviews

  46. Simply wish to say your article is as astonishing.
    The clearness in your post is just spectacular and i can assume you are
    an expert on this subject. Fine with your permission allow me to
    grab your feed to keep up to date with forthcoming post.
    Thanks a million and please continue the gratifying work.

  47. Pingback: Multimedia Services | MMCS News And Reviews

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