Ambi-tv – ampilight effect from any Video (i.e. HDMI) source

Connecting HDMI signal to raspberry pi and using it as a source for the lights behind the tv, seems to be very tricky in the beginning – in fact it is not, but it requires some additional components to be bought and installed. Unfortunately these components are not cheap… You may be lucky enough though to have scart/composite/av output in your PVR or amplituner, that provides signal in parallel with HDMI. If that’s the case, you will get what you want for very reasonable price.

No matter if you go with HDMI or RCA you will definitely need USB Video Grabber. Here is our tutorial on how to chose the grabber and how to install it on RPI.

Now, let’s start from more popular although the most expensive option, which is HDMI. If you want to use HDMI signal (from PS3, for instance), the first thing you need to do is to split the signal before it gets to TV. You can do that using HDMI splitter. Then, one output of the splitter connects to TV. The other output we will connect to the grabber, but we cannot do it directly as the cheapest grabbers cannot handle full HD resolution (are there any that can?). So, in order to pass the signal through the grabber we need HDMI to AV converter – it must have downscaler embedded to provide PAL or NTSC resolution at CVBS (RCA) output. Finally we can connect converter to a grabber. Here is how the whole set looks like:

HDMI Kit

HDMI Kit

On lighbterry.eu you will be able to buy this one soon:

HDMI Premium

HDMI Premium

If you have a device that provides signal on HDMI and SCART (or Composite) in the same time, your setup will be much simpler as you don’t need HDMI splitter and HDMI to AV converter, as these are somewhat already embedded in your device. The rest remains the same, in other words, you can connect signal from SCART (or Composite) directly to a grabber.

Simple, isn’t it? :)

Now the only thing we have left is to configure raspbian to be able to interpret the signal and control the lights.

1. Remove SPI driver from black list by adding hash # sign in the begining of the line of /etc/modprobe.d/raspi-blacklist.conf file.

2. In /etc/modules file add a line:

3. Here we get huge help from wonderful Hyperion team that delivered (with tiny bit of our help in testing) hyperion-v4l2. Just install hyperion the usual way, upload configuration file to /etc/hyperion.config.json and run:

Of course, these parameters’ values are only examples and you can adjust them to your needs. I advice you to loook at Hyperion Issue #12 to get more information about configuration and new features.

We have also prepared pre-configured system image with cec support. Just press “play” button to start ampilight – press “stop” button to switch off the effect. When power button is pressed, RPi will shut down.

System image: (torrent) pre-configured raspbian

[Update 12.04.2014] Thanks to great work of Husam Hebaishi, we prepared Raspbmc image with Fushicai grabber and hyperion installed. Here is a torrent file: raspbmc_with_fushicai_lightberry.zip.torrent
[Update 13.04.2014] I have noticed that hyperion does not work properly with the image as above. We will update the image as soon as it is fixed.
[Update 27.04.2014] Thanks to great work of Husam Hebaishi (again), we have now newest Raspbmc with Fushicai grabber support. Works flawlessly :) Here is a torrent file: raspbmc_with_fushicai_lightberryv2.zip.torrent

I hope you’ll enjoy that!

Here is your raspberry pi ampilight system!
  • STF

    Thanx to everyone for there time and effort. Even this newbie got it to work now.

  • Vinícius Alves

    Is it possible to use a sattelite receiver with HDMI/AV output to do the passtrough??

    • Jacek

      Sure! that’s what I am doing :)

  • Guest
  • Vinícius Alves
    • Jacek

      In China :) Unfortunately it is 15$ more expensive than separate splitter and converter. That’s why at http://lightberry.eu we’re selling the latter…

      • Romain

        Have you a link for this ? i don’t find this anywhere :(

  • Vinícius Alves

    My last question, there’s a way to use common RGB led strips in various channels like the old way instead of the addressable one?? I ask because i have 25 meters laying around…

    Thank’s.

    • Jacek Tokar

      No idea…

  • Tiim

    Is it also possible to disable the CEC? I don’t use my TV remote and just would like to have hyperion for HDMI input always running when the raspberry starts.

    • Jacek

      What do you mean by “disable CEC”?

      • Tiim

        I meant: do i need to turn Lightberry on? I use a Logitech remote, so it would be usefull when hyperion is always on. So disable the CEC module. It’s fine when Lightberry is always on for my because i use any HDMI device.

        • Jacek

          Sure, you can do that. Just put hyperion-v4l2 command in pilot.sh file while removing everything else.

          • Fritz Duggan

            Where might one find the pilot.sh file? Sorry, I am a bit of a noob.

            So you are referring to this command:

            “”grabber-v4l2” :
            {
            “device” : “/dev/video0”,
            “input” : 0,
            “standard” : “no-change”,

            ….”

            and it is getting removed from the hyperion config in return?

            Thanks!!

          • Jacek

            Fritz, pilot.sh is in /home/pi

          • RajenK

            Any chance you could elaborate a little bit more on this (for a newbie)? I would also like to have it disabled, so my TV doesn’t automatically switch to the HDMI input for the Raspberry every time it boots (I just want it running Lightberry with the HDMI as input at all times). Thanks!

          • Jacek

            You can use our raspbmc image. It does work with external input automatically after the boot. You can also edit /home/pi/pilot.sh and leave only hyperion-v4l2 line there.

  • Vinícius Alves

    does hyperion run on a linux pc, without raspberry pi??

    • Vinícius Alves

      or something like hyperion for windows??

  • Richard Osborn

    raspbmc_with_fushicai_lightberryv2.zip.torrent seems to not have valid trackers, they keep timing out. I would love to try out V2!

    • Jacek

      Richard, I will fix it in the evening. Till then, simply remove .torrent suffix from the link address :)

      • Richard Osborn

        It appears the trackers sorted themselves out. Thanks for the reply though !

  • RobW

    ok, I see you now have the torrent raspbmc_with_fushicai_lightberryv2.zip.torrent

    So, what exactly do I need to do with it? Execute it? unzip it? put it in the conf file?

    Can you just tell me the exact commands I need to run to get this to work? Grabber appears to be working as when I type

    sudo /opt/hyperion/bin/hyperion-v4l2 –size-decimator 8 –frame-decimator 2 –skip-reply –signal-threshold 0.08
    The lights change color and now react to video input. I just want the PI to start up, starting running the grabber and stop running it when the video feed stops getting input.

    Thx!

  • lance colton

    how am i supposed to edit or replace the hyperion.config.json14x8 file? I delete / overwrite it but when i reboot the rpi it restores the original :(

    • Jacek

      Hi Lance, have you tried editing /etc/hyperion.config.json as root?

      • lance colton

        No, I only figured out the pi/raspberry account. It has that hyperion.config.json14x8 file in the home directory, so I thought that’s the one. I’ll try again when I get home.

      • lance colton

        Okay, it works now, as long as the hdmi 2 av thing is on ‘PAL’. Thanks!

  • student

    Do you know when light berry is going to be selling the HDMI Premium? Also have you ever considered using an all in one HDMI switch/splitter so you can easily choose from multiple inputs?

  • Marco

    does that premium kit hase hdmi out and in? or do you still need a hdmi splitter ?

    • Jacek

      It is splitter+converter to AV in one box

      • Marco

        but if my AVR does not support the convert of analog to digital there would be a problem, right? because i think i would need to get the hdmi from my avr to the “box” and one hdmi from the box to my tv….?

        • Jacek

          If you have analog output already it ia even beter as you don’t need expensive hdmi2av converter and splitter. AV signal can go directly to the grabber

          • Marco

            so if all my other components (bd player, ps3 and sat receiver) come with hdmi to my yamaha av-receiver and hdmi goes out of the receiver i will need that converter too, am i right? totally confusing… sorry :>

          • Jacek

            Does your yamaha have av (composite) output, that is active along with hdmi?

          • Marco

            hm good question! the only thing i know if i put some hdmi input in the yamaha it must go out with hdmi out again…. he is not able to convert from digital to analog…. i think! its a YAMAHA RX-V373, can i test that anyhow? :>

  • Chris Garza

    Hi, I’ve followed the instructions to a T and have even tried the “pre made” images but every time I run ”

    mplayer tv:// -tv device=/dev/video0 -hardframedrop” I get:
    “MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
    mplayer: could not open config files /home/pi/.lircrc and /etc/lirc/lirc/lircrc
    mplayer: No such file or directory
    Failed to read LIRC config file ~/.lircrc.

    Playing tv://.
    TV file format detected.
    Selected driver: v4l2
    name: Video 4 Linux 2 input
    author: Martin Olschewski
    comment: first try, more to come ;-)
    Selected device: usbtv
    Capabilities: video capture read/write streaming
    supported norms: 0 = NTSC; 1 = NTSC-M; 2 = NTSC-M-JP; 3 = NTSC-M-KR; 4 = NTSC-443; 5 = PAL-M; 6 = PAL-60;
    inputs: 0 = Composite;
    Current input: 0
    Current format: YUYV
    tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
    Selected input hasn’t got a tuner!
    v4l2: ioctl set mute failed: Inappropriate ioctl for device
    v4l2: ioctl query control failed: Inappropriate ioctl for device
    v4l2: ioctl query control failed: Inappropriate ioctl for device
    v4l2: ioctl query control failed: Inappropriate ioctl for device
    v4l2: ioctl query control failed: Inappropriate ioctl for device
    vo: couldn’t open the X11 display ()!
    vo: couldn’t open the X11 display ()!
    vo: couldn’t open the X11 display ()!
    VO XOverlay need a subdriver
    [VO_SDL] SDL initialization failed: Unable to open a console terminal.
    vo: couldn’t open the X11 display ()!
    vo: couldn’t open the X11 display ()!
    vo: couldn’t open the X11 display ()!
    ==========================================================================
    Opening video decoder: [raw] RAW Uncompressed Video
    Could not find matching colorspace – retrying with -vf scale…
    Opening video filter: [scale]
    Movie-Aspect is undefined – no prescaling applied.
    [swscaler @ 0x8e0ee0] BICUBIC scaler, from yuyv422 to rgb565le using C
    VO: [fbdev] 720×576 => 720×576 BGR 16-bit
    Selected video codec: [rawyuy2] vfm: raw (RAW YUY2)
    ==========================================================================
    Audio: no sound
    Starting playback…
    v4l2: ioctl dequeue buffer failed: No such device, idx = 0
    v4l2: ioctl query buffer failed: No such device, idx = 0

    MPlayer interrupted by signal 11 in module: filter_video
    – MPlayer crashed by bad usage of CPU/FPU/RAM.
    Recompile MPlayer with –enable-debug and make a ‘gdb’ backtrace and
    disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash.
    – MPlayer crashed. This shouldn’t happen.
    It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
    gcc version. If you think it’s MPlayer’s fault, please read
    DOCS/HTML/en/bugreports.html and follow the instructions there. We can’t and
    won’t help unless you provide this information when reporting a possible bug.
    [ This binary of MPlayer in Debian is currently compiled with
    ‘–enable-debug’; the debugging symbols are in the package
    ‘mplayer-dbg’.]”
    Please help!! What am I doing wrong?

    • Jacek

      What grabber do you have?

      • Chris Garza

        UTV007.

        root@raspbmc:~# lsusb
        Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
        Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
        Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
        Bus 001 Device 004: ID 1b71:3002

        • Chris Garza

          I’m currently using raspbmc_with_fushicai_lightberryv2.zip.torrent.
          I was not able to remove the SPI from the black list since my /etc/modprobe.d did not contain raspi-blacklist.conf but instead had fbdev-blacklist.conf which didn’t contain the SPI in it. I was able to get mplayer to display a green screen by stopping xbmc and running sudo mplayer -tv driver=v4l2:width=128:height=64:device=/dev/video0 -vo
          fbdev -fs -fps 24 tv:// /dev/null 2>&1 &

          • Jacek

            Chris, with V2 image (btw, V3 will be available tonight) you should not run hyperion-v4l2 separately. Ambilight should work out of the box (if you have right config). Do you have grabber-v4l2 defined in hyperion config?

          • Chris Garza

            I have added the following code to my hyperion config:
            “grabber-v4l2” :
            {
            “device” : “/dev/video0”,
            “input” : 0,
            “standard” : “no-change”,
            “width” : -1,
            “height” : -1,
            “frameDecimation” : 2,
            “sizeDecimation” : 8,
            “priority” : 800,
            “mode” : “2D”,
            “cropLeft” : 10,
            “cropRight” : 10,
            “cropTop” : 1,
            “cropBottom” : 1,
            “redSignalThreshold” : 0.1,
            “greenSignalThreshold” : 0.1,
            “blueSignalThreshold” : 0.1
            },
            Is this correct? Thank you so much for your help! This is my first ever experience with linux so I’m completely ignorant to everything.

          • Jacek

            Width and height should not be -1. I suggest you take a look at raspbmc config files at lightberry.eu

          • Chris Garza

            Thanks for the help and direction. It’s working well now. Though I need to reset the pi several times to get it to work. Thanks again!

  • cannfoddr

    Got this working on the V3 image. Now my TV doesnt support CEC so how can I control the effect short of pulling the power on the Pi

    Adrian

    • Jacek

      CEC should continue working with this image

  • tuandbui

    will this setup hyperion work if i use HDMI out from my computer? i use OSX for daily usage/movies and win8 for gaming. it seems like hyperion only pulls video feeds, not capturing desktop screens.

    • Jacek

      Yes, it will work with hdmi kit (up to full hd). Could you elaborate more about what you meant in your last sentence?

      • tuandbui

        hi thanks for replying. My understanding was that hyperion would only read video feeds from movie files via vl4c. Since some game wouldn’t work with the other routes. I was afraid that it wouldn’t capture my desktop screen.

        • Jacek

          As long as your desktop image will be transmitted via HDMI, it will work.

  • Ryguy

    Hello, so I’ve got the Raspbmc/Fushicai image and the premium Lightberry
    setup and it works great, however the lights only seems to work with
    the RPI output and not the hdmi splitter at all. Essentially the lights
    never sync with any HDMI input devices (PC or PS3) via the splitter – I
    see video image on the TV via the splitter so its working fine, just that the lights stay sync’d with raspbmc. Any suggestions? =)

    • Jacek

      Could you check if xbmc-system-settings-remote control have both options on? If not, turn them on and restart pi.

      • Ryguy

        Hey, thanks for responding! I have confirmed that they were both not on, the ‘GPIO TSOP IR Receiver’ was not enabled, so i enabled it. Unfortunately that did not resolve the issue. I even attempted to use every profile I could select however after numerous reboots the lights just output a stale blue (from the raspbmc title screen) and never change to the PS3 output. The remote profile that was there by default is ‘MCE RC6 Remote’ – please let me know if that is incorrect haha. I unfortunately do not have any RCA cables to 100% confirm the easyCAP is working correctly however the power light is on and the lightberry lights do not work without it plugged in, moreover my PC is able to pick it up and download the driver without issue, so I do think this may be a configuration issue somewhere

      • Ryguy

        So I re-read your instructions and when I looked in the correct spot “xbmc-system-settings” instead of the raspbmc settings haha – I did enable the remote control as you suggested and the lights now work specifically with the hdmi splitter input so it works!!

        Thank you very much for your support!

        • Jacek

          Yeah! :)

  • Brandon Butler

    Might I also suggest making the raspberry-pi a read-only file system as I have done here?https://github.com/tvdzwan/hyperion/wiki/Make-Raspbian-Read-Only

    • Jacek

      Interesting… I will have a poker at it after my vacation. Can you do the same with openelec?

      • Brandon Butler

        Probably. Just when you do it this way settings are not saved. (Think of it like a live linux CD) The beauty with this setup is I have the pi and lights on 1 switch. I turn it off and it doesn’t damage the sd card anymore. I don’t need to properly shut down the pi :)

  • Brandon Butler

    Another thing is it appears you no longer need to start a seperate v4l2 script. You can just modify the config file. I’m going to experiment with this approach later. But it should help to reduce lag. https://github.com/tvdzwan/hyperion/wiki/V412-Grabber

  • Roberto

    It is possible to use a different USB grabber such as febon 168 which has a hdmi input and support resolution up to 1080 p ? In this way I think that I can connect the cable to the hdmi splitter. There will be a lot of lags or the raspberry couldn’t elaborate the signal very well due to the high resolution ?

    • Jacek

      I don’t think that raspberry is capable of processing of such high resolution

      • Roberto

        On their site is written that it can support 1080 p resolution but I don’t if this has any connection with the video grapper.. They are two different things no ?

  • Furby8704

    cant get it to work with my lightpack. lights work fine when using the pi itself or when i connect to it via hyperion plugin from another xbmc machine but not from any other source. using lightberry raspbmc image.

    hd splitter and hdmi2av work fine because ive hooked it up to an output on my tv
    just not sure if the card is picking up the feed. i have the stk1160 chipset.

    ive been able to make it work with my mac but of course i would like to have my raspberry pi or custom htpc running openelec be able to do all the process.

    cant have my mac hooked up at all times lol

    any help?? please :)

    • Jacek

      Check with hyperion-v4l2 –screenshot what image is going to hyperion

      • Furby8704

        Ive done it before. So i stop hyperion to do it but im not sure what to look for
        I get an output but when i go to look for it theres nothing there. Where exactly is the screenshot going to??

        • Jacek

          screenshot should be in current working directory

          • Furby8704

            i dont get back anything. ive done command in /home/pi and in /home/pi/.xbmc/temp and theres nothing new there

          • Furby8704

            i just tried this method http://raspberry-at-home.com/video-grabber-for-raspberry-pi/
            and i get the video output from mplayer but not sure how to get the lights to read it

          • Jacek

            Increase threshold parameters in transform section.

          • Furby8704

            “blueSignalThreshold” : 1.0. After 5 seconds, the leds go off. thanks! :)

          • William Darko

            hi there.
            got everything up and running except for this weird thing.
            when everything is off all my leds are still on mostly purple and green.
            have tried to change the treshold but not fixed it…
            any suggestions ?

            thx a lot

  • ja105ny

    I bought all the above and have WS2801 lights. Do I just download the most recently uploaded image and it will work fine? I have the Fushicai grabber.

  • Budi

    Hello, i’am new into this aventure.

    I have the same material, but when i shutdown the AV Receiver, Leds remains switched on.
    I must disconnect power of the splitter.

    Any idea ?

    Ps : sorry for my bad english

    • Jacek

      What colors do leds display? Dimmed white?

      • Budi

        I have the same colors as William Darko writes more low.

        When the Hdmi2av does not receive a signal, he show this image.

  • Joey Ross

    V2 torrent seems to be down again. I removed the .torrent suffix but what do I do with that? It does not resolve.

    • Joey Ross

      Had to use a site to find more trackers but it found one last night and took 11 hours to download. I’ll try v2 when I’m home from work!

  • Darek

    does anyone can share again the latest torrent file (raspbmc_with_fushicai_lightberryv2.zip.torrent)? utorrent says it will take a year to download…

  • Bill

    I have fully setup Raspbmc with your hyperion but when starting pi the lightpack does nothing and I have yet to get the lights to come on. Anyone know what to troubleshoot?

  • Ken V

    After reading through the German Rpi forums (http://www.forum-raspberrypi.de/Forum-ambilight ) regarding Ambilight, I get the impression that there seem to be a lot of issues using the Rpi2 with instability of drivers for the stk1160. If I were to buy a RPi specifically for doing HDMI capture to run the LEDs, am I better off getting the RPi B+? Thanks for any help you can provide.

    • Jacek

      Hi, we’ve seen some issues with stk1160 and b+ as well. I would not blame hardware though – it is seems to be software related issue. Utv007 grabber is much safer option these days

  • Vincent Miedema

    When I install the pre-configured raspbmc v2, non of my usb devices are working, tried other keyboards but nothing works. I am using a b+ and a 8gb micro sd card. Installing osmc or openelec does work with my current keyboard. Am I doing something wrong?

    • Jacek

      Is it working fine with other OSes? It may be power supply problem

      • Vincent Miedema

        (thank you for replying)
        Yes it is working fine with other OSes. Everything works on osmc, openelec and rasbian. Power suply issue? Im using osmc with hyperion +keyboard and there are no problems with that. Do you really think that might be the issue? I can try and get myself a powerd usb hub if you think that is the case.

        • Jacek

          No idea how to verify that without doing actual test with the hub, although that would be weird that it doesn’t work only with raspbmcV2. Any reason why you need to stick to that version?

          • Vincent Miedema

            Hello,
            sorry for the late respons, was busy with school this month.
            I finaly got myself a powered hub, but no good. The keyboard and other stuf stay unresponsive. I’ve also tried using the .img from greatscott (youtube) and the one’s from lightberry. They all give me the same result. It’s all working fine when I download and install osmc or retropie from their site.

          • Jacek

            Have you tried OSMC from lightberry?

          • Vincent Miedema

            The only OSMC I see on their site is meant for the RPi2, I assumed it wont work with RPi1. So I didn’t try that one yet.

          • Vincent Miedema

            tried the osmc from lightberry as well, nothing turns on. Not sure whats causing this..

  • Vincent Miedema

    Okay, after trying differnt options, I’ve got most of it working. But when I connect the HDMI splitter I end up getting 480p signal on my monitor and can’t upscale it. Same with PlayStation, only works on 560p. Am I missing something?

    • Jacek

      I suspect that your HDMI->CVBS converter is piece of cr.p and it does not support FHD. It looks like the splitter detects that and informs your video source, so that it could downscale the image to support ‘the worst’ device.

      • Vincent Miedema

        You are correct. After visiting the Hyperion forum, some guys pointed me to a imgur image which showed a fake HDMI2AV converter which could only support 480p. And mine had similar internal specs, so I ordered a new one last week which claimed to have 1080p output.

  • Mikkel Hansen

    my yellow i more green than yellow how to fix?

    • Jacek

      Play with color settings in transform section of the config file… (decrease whitelevel of green)