How to build an Ambilight for every HDMI input source

In this post I’m going to show how you can configure your Hyperion Ambilight for every HDMI source. If you don’t have an Ambilight setup yet, I kindly refer you to my previous guide, which will give you an initial ambilight effect for the media center running on the Rpi.

This guide will then go one step further and enable the ambilight effect for all kind of HDMI input sources like PS3, XBOX, Chromecast etc.

We need to get the color information from an HDMI input signal. For this purpose, it’s necessary to transform the digital HDMI signal to an analog composite one with a converter. After this, we can grab the composite signal with an USB video grabber connected to the Raspberry Pi. Now we’re able to feed Hyperion with the color information by the video grabber.

Parts list

AVR Receiver It’s essential. Most TVs don’t offer an HDMI output
HDMI to Analog converter Speaka Professional HDMI / Composite Converter. There are several others on the market, make sure that you got one with 1080p support. Check this guide for more details about the available chipsets
2 port HDMI splitter My AVR features two HDMI outputs. Otherwise make sure you’ll get one!
USB Video Grabber (Easycap) Make sure you got a grabber with the STK1160 chipset, because it’s fully supported on Linux! Check here for detailed instructions, this can be tricky…I’d recommend a grabber with the UTV007 (Fushicai) chipset. It’s supported with OpenElec >=4.2.1 and features the best results for this purpose.
Composite cabel Just a standard video cinch cabel
Active USB Hub The Raspberry won’t be able to power most of the devices directly from it’s USB port.

Let’s wire it up. Connect the HDMI output from your AVR or from your HDMI splitter to the HDMI / Composite converter input. Use the composite cabel for connecting the USB video grabber with the Composite converter analog output. Plug the USB video grabber into the active USB hub, connect the hub to the Raspberry Pi.

If you already have a running media center then you might already have an analog video output on this machine. In this case, connect the analog output to the grabber, directly. Another possibility would be to go for an DisplayPort to composite converter that connects to the USB grabber. For both solutions, make sure that your existing media center is capable of playing your media to both outputs, simultaneously otherwise you’ll need to go for a 2 port HDMI splitter (without AVR) and HDMI to composite converter.

Here’s my setup connected, ready for video capturing from any HDMI input.


1. USB Video Grabber setup

Connect the USB Video Grabber to the Raspberry and type

Unfortunately, my device with “ID 1b71:3002” features a Fushicai UTV007 chip, which is only initial supported with kernel 3.11. This forced me to compile the kernel module myself. If you got the same problem, here’s my precompiled module “usbtv.ko” for Raspbmc with kernel 3.10.36. Make sure you first load the modules “videobuf2-vmalloc” and “videobuf2-core”, than load the module with insmod usbtv.ko.

OpenElec (>=4.2.1) has the driver for Fushicai UTV007 already included, therefore it will work out of the box. Remember, to enable ssh you have to boot OpenElec with TV connected. After that, you won’t need the installed XBMC/KODI anymore. It seems like the current Raspbmc release has the driver not included. SSH to openelec and install hyperion:

Then copy your hyperion.config.json to the shared SMB “Configfiles” folder from your host system. The shared “Configfiles” folder is actually mapped to /storage/.config on the Rpi filesystem. After a Rpi reboot, Hyperion should autostart and load the config from /storage/.config/hyperion.config.json automatically, though.

Remember that you have to set the library path for OpenElec setups before you can execute any hyperion command:

Stop / Restart hyperion manually:

Take a screenshot from the grabber with following command. Remember to kill hyperiond before you can execute this command properly!

For further instructions, make sure to checkout the documentation.

2. Hyperion configuration

Hyperion already features capturing color information from a USB video grabber. Add following configuration to your hyperion.config.json file to enable it.

To adjust the cropping for your setup, you have to change the values “cropLeft, cropRight, cropTop, cropBottom” and make sure “device” matches with your ls /dev/video* output!

Check the created screenshot.png, adjust the crop-* values till the grabbed input has no black borders left. Then put the calibrated values into your /etc/hyperion.config.json file.

Screenshot from my USB grabber input, I was able to get rid of the upper and lower borders by adjusting the cropTop and cropBottom values. I was able to get rid of the green lines after increasing “frameDecimation” to 8 but then a lot of frames were skipped and the LED’s were out of sync to the moving picture. So I set it back to 2.

If you only want to grab the signal from the v4l2 video grabber, make sure that you remove the “framegrabber” and xbmcVideoChecker sections.

Let’s test some videos! If you don’t like the results, try to fine tune your setup with different SignalThresholds or try to adjust the hsv settings. Make sure to read this comprehensive guide about color transformation.

When you switch the HDMI source on your AVR to non HDMI sources, like for example audio only devices, the LED’s will light up in blue. Blue is the default color if no video source was detected for many AVRs. You can disable the LED’s in this situation by setting the blue-threshold value to 1.0.

3. Conclusion

Now you should be able to use your Ambilight for any HDMI input you have connected to your AVR. If you have any question, feel free to ask in the comments section. Enjoy your unleashed Ambilight!

170 thoughts on “How to build an Ambilight for every HDMI input source

  1. Great info here! I was wondering if you might be able to help with a related issue. I’ve got everything hooked/wired up properly (with one issue). I can not get a proper signal/screenshot from my receiver (Onkyo RC260), but the entire set up works great if I just feed the Xbox One to the splitter. Obviously, I would like everything to have the effect, but the screenshots I take with my pi just look like a rainbow-colored image of the actual image on-screen (and this makes the entire LED system stay a soft white/red/pink color). But when I take a screenshot from the pi with just the Xbox hooked up, it looks just like it should. Playing Halo with the LED effect is great! I’ve tried swapping HDMI cables from all over the place, but still have the same issue. Any help would be great! Thank you.

  2. Hi there Chris.

    I just dropped by to say thank you for this and your previous tutorial on non Philips Ambilight solutions. Im planning a TV upgrade to something other than Philips TV, and because my other half loves Ambilight I wanted to keep that.
    I will pop by once I
    ve put something together.

    Thanks again!!

  3. Hi Chris, thanks for the tutorial, works great, the only issue I am having is when the screen goes black the lights are still glowing for 5 seconds or so then turn off…any idea what could be causing this? Black levels too high perhaps?

  4. Hi, first thanks for that awesome Tuto !

    I have a slight issue. When I take a screenshot I get a lot of green lines on my image. Do you know what can be the issue ?

    Thanks !

    1. And it’s seems that it’s not hapenning to every frames. Sometimes I get one normal (without the green lines)

      1. Hi Ludo, you’re very welcome.

        My setup has the same issue, it shouldn’t have much input on the color grabbing. You can try reduce the lines by playing areound with sizeDecimation (8) and / or frameDecimation (2) in hyperion.config.json.

        Regards Chris

  5. Thanks for this tutorial!

    Small question, my screenshot is pretty red and i can’t seem to get it to show in normal colors. Any ideas? I’ve tested around with the thresholds..

    Thanks for the support.

    1. You’re welcome. increasing the “redSignalThreshold” and restart hyperion should work. Did it change anything?

    1. Hi John, yes, you can use a splitter in combination with a video grabber. You can’t use the rpi HDMI for grabbing because the digital hdmi signal can’t be easily decrypted.

  6. wow I’m glad to fund this page! I’ve been looking for an Ambilight solution for my project to work with all my device no just Movies from HTPC other than arduino,teensy board solution!!

    before going deep to this project and buy all I need I want make sure if can be done for me can you help?

    first my Amilight project will be for a big fixed screen 108Inch with around 250Led
    lucky I bought recently a AVR yamaha 2040 with 2 output HDMI simultanous :)
    so if I understand your tutorials I wont need a spliter right? just a hdmi2AV ?

    so can you conform
    I can I use a raspberry pi to compute the ambilight form hyperion to the light strip and have my HTPC,PS4 to output video at the same time?
    what is the lag? do I need to be limited for number of light before fps drop with raspberry or it’s unlimited?
    what type of light strip it’s supported with this raspberry configuration? ws2801,2811,2812b…ec?

    thank you

    1. Hi Chris,

      Yes, you won’t need a splitter and use the PS4 and the ambilight at the same time. I’d recommend WS2801, it’s cheap and you can connect it directly to the Rpi. I have no experience with so many LED, you’d need to try and tweak if it’s not working. My setup with 138 LEDs works very smooth.


      1. Thanks Chris!!!
        well I’m going with a different led after some reseach,I will have 140 led 36mm Square 12V Digital RGB LED Pixels – WS2801 they will put .9watt/ by pixels around the screen so i think i should be fine 😉

        now I have another question:

        I pre wired my home theater stuff into a cabinet witch is about 15ft from the the projector screen led strip and I would like to have the raspberry,usb graber…ect in there as well
        I pre wired some 18 awg and 14awg electric wire that goes to the raspberry board later
        so do you think 15ft long wire will be fine to run smooth into the led strip or do I need to have an USB cable of 15 ft that goes to the raspberry on back of the screen instead?

        1. Hi Chris,
          I’m curious about the final result with those interesting square LED, please share :-)
          I would definitely recommend the USB cable approach, since SPI is designed for short distance communication between integrated circuits.

  7. Hi Christian,
    I like to know something before i order devices:
    My AV receiver from Yamaha (A840) has an video (monitor) output. So i think I do not need a HDMI splitter and a HDMI2AV converter. I can connect the Video Grabber directly. Is it right or have i misunderstand something?

    Thank You for your support

    1. Hi, you should check if the AVR is able to output a signal through the HDMI & the monitor at the same time. Regarding the manual, this functionality was blocked for my AVR because of copyright reasons of HDMI material.. but if yours is capable of this, you won’t need a HDMI splitter and HDMI2AV converter.
      If not, it looks like the 840 AVR got two HDMI out, so you would just need a HDMI2AV converter, no splitter.
      Regards Chris

  8. Hi Christian,

    I have a problem with my splitter and av converter.When I toke scrrenshot form grabber I got blackscreen(TV007 Fushicai chipset).After that I checked my splitter and converter I couldnt find which has a problem. Because when I test them without connect to eachother they are working.

    My Scenarios :
    PS4 -> HDMI2AV -> TV ıts ok, working.
    PS4 -> HDMI splitter -> out 1 TV1
    -> out 2 TV2 both of them working,too.
    PS4 -> HDMI splitter -> out 1 working
    -> out 2 HDMI2AV -> TV2 not working.
    PS4 -> HDMI splitter -> out 1 HDMI2AV -> TV2 not working.
    -> out 2 TV1 working

    Which one has a problem do you think ? Thanks for your helps.

    My devices

    1. Hi, is your hdmi2av converter able to downscale 1080p signals? Could you try to lower the resolution to 720×576 for the hdmi input device. Could be that the splitter forces the signal to 1080p, while the hdmi2av would set it to 720p.
      Regards Chris

      1. I think it is able to downscale 1080p signals. Because when I connect ps4 to hdmi2av directly to the TV’s AV input I can see the ps4 screen.

          1. Hi, i’m having the same issue as you, where did you get your working HDMI2AV convertor from??

  9. Hi Christian,

    I’m having a problem that I can’t seem to figure out and I was hoping on having your insight. Everything seems to be working well but there is a slight lag between what is shown on the TV and the LED color. I would say there is a 1/2 second lag. I have played around with the smoothing settings but I do not think the problem is related to it after toying around with it.

    Any ideas on how I can get rid of the lag? I have 173 LED’s for my setup. Is that too long?

    Thank you for the help as always

  10. Good morning.I managed to install and run my LED strip with Open Elec, but when trying to install video grabber (fushicai) LEDs do not follow the TV (set top box). I connected as follows: (RPI – TV); (Set top box – TV and grabber) and (grabber – RPI).
    My Json setting was so.

    “endOfJson” : “endOfJson”,
    /// Configuration for the embedded V4L2 grabber
    /// * device : V4L2 Device to use [default=”/dev/video0″]
    /// * input : V4L2 input to use [default=0]
    /// * standard : Video standard (no-change/PAL/NTSC) [default=”no-change”]
    /// * width : V4L2 width to set [default=-1]
    /// * height : V4L2 height to set [default=-1]
    /// * frameDecimation : Frame decimation factor [default=2]
    /// * sizeDecimation : Size decimation factor [default=8]
    /// * priority : Hyperion priority channel [default=800]
    /// * mode : 3D mode to use 2D/3DSBS/3DTAB (note: no autodetection) [default=”2D”]
    /// * cropLeft : Cropping from the left [default=0]
    /// * cropRight : Cropping from the right [default=0]
    /// * cropTop : Cropping from the top [default=0]
    /// * cropBottom : Cropping from the bottom [default=0]
    /// * redSignalThreshold : Signal threshold for the red channel between 0.0 and 1.0 [default=0.0]
    /// * greenSignalThreshold : SigSignal threshold for the blue channel between 0.0 and 1.0 [default=0.0]
    “grabber-v4l2” :
    {nal threshold for the green channel between 0.0 and 1.0 [default=0.0]
    /// * blueSignalThreshold :
    “device” : “/dev/video0”,
    “input” : 0,
    “standard” : “no-change”,
    “width” : 640,
    “height” : 480,
    “frameDecimation” : 2,
    “sizeDecimation” : 8,
    “priority” : 1000,
    “mode” : “2D”,
    “cropLeft” : 26,
    “cropRight” : 27,
    “cropTop” :20,
    “cropBottom” : 20,
    “redSignalThreshold” : 0.1,
    “greenSignalThreshold” : 0.1,
    “blueSignalThreshold” : 0.1

      1. yes, the screenshot is perfect but every time I turn on RPI the lights follow the screen KODI and not TV (Set Top Box)

        1. ok, that’s good to hear. Then all you need to do, is to lower the “priority” setting of the v4l2 grabber. Default is 800, the lower the value, the more priority the grabber gets. Try lowering the priority until the grabber is chosen over the xbmcVideoChecker.

          1. thanks, I’ll try it.
            Sorry for my English, I do not speak English very well. I live in Brazil.
            I use WinSCP to tranfereir files between windows and RPI. I deleted the file hyperion.config.json who was in the RPI, but the LED continued to work as before. This is normal?
            What version of OpenElec you use, I’m using the latest version.
            I will try your suggestion.
            Sorry my bad writing.

          2. Did I copied the file to the wrong place. The file is in the / storage / hyperion / config and in the / storage /. I can not find the configfiles folder.

          3. for openelec you have to copy the config file to: /storage/.config/hyperion.config.json then stop and restart hyperion:
            killall hyperiond
            LD_LIBRARY_PATH=/storage/hyperion/bin /storage/hyperion/bin/hyperiond /storage/.config/hyperion.config.json

          4. Hello, I managed to make it work. The problem was that I was putting the .json file in the wrong folder. The correct folder is the folder / configfiles. Unfortunately for WinSCP I could not see this folder. I had to enter through windows explorer. Thank you for your help.

  11. I just wanted to say thanks for writing this all up! I mostly have it all working but I’m running into an issue where the crop values are being ignored whenever I take a new screenshot.

    Do you have any pointers on how to fix this?

    Thank you!

    1. Hi Steve, your welcome!
      The parameters in the hyperion.config.json are not taken into account when you take a screenshot. Therefore, you have to add the crop values and all other arguments for the screenshot command to get the same resulto r what do you mean?
      Regards Chris

      1. I use the following totake a screenshot:
        “LD_LIBRARY_PATH=/storage/hyperion/bin /storage/hyperion/bin/hyperion-v4l2 /storage/.config/hyperion.config.json –screenshot”
        Which does not allow me to change the crop values.

        But when I tried to take a screen shot using what you wrote in the later portion of your tutorial: “// Stop hyperion
        sudo initctl stop hyperion
        // start any HDMI video source and make a screenshot from the grabber input. This will use the external v4l2 grabber
        hyperion-v4l2 –crop-top 0 –crop-bottom 0 –crop-left 0 –crop-right 0 –size-decimator 4 –frame-decimator 2 –red-threshold 0.4 –green-threshold 0.2 –blue-threshold 1.0 –screenshot”

        I get the following error: ” hyperion-v4l2: not found”.

        What is the proper command where I can add in the crop values and other arguments?

        1. Just as I sent my last reply, I had a lightbulb moment! I think I have everything set up and will be doing a first test on the LED’s!

      2. Hi Chris,

        I finally have everything hooked up but I’m running into some problems.

        1) for some reason, only a quarter of my LEDs are on. and it seems like its only the center 20 or so. And the ones that are on are only Red Green and Blue. Any ideas on why this is happening? I’ve already checked the screen shot and it looks good to me.

        2) As mentioned in 1, only part of the LED lights are on and it seems to be the center that are on. I sized my power supply correctly (5v, 10A) and should work with my 153 LEDs.

        Thanks for all the help!

  12. Hey Christian, great guide!

    I’ve managed to create a similar setup of my own. But I have some problems. When I capture a screenshot I get a lot of interference.
    I captured my computer when I only had a chrome window up and a terminal in the bottom right corner. As you can see its a mess of odd colors, which in turn results in flickering of the leds and incorrect colors.

    Do you have any idea what may cause this?

    My setup is like this:
    AVR -> HDMI splitter -> 1 to Projector, 1 to a HDMI to AV converter similar to yours. (—Video-converter—HDMI—black/). Converter -> logilink grabber (STK1160 chipset) -> raspberry running rasbian with hyperion.

    Could it be the grabber? Maybe faulty drivers. I will try to do some debug, checking output in each step.

      1. Yeah, I think I’ll find another grabber with TV007.

        When I checked the composite output after the converter the image was ok, although it had a bit of interference. Maybe I’ll try to find another converter as well.

  13. Hi.
    Great guide, very easy to implement.
    Only issue I’m having is:
    After setting all the cropping using command line:
    “LD_LIBRARY_PATH=/storage/hyperion/bin /storage/hyperion/bin/hyperion-v4l2 –crop-top 0 –crop-bottom 0 –crop-left 0 –crop-right 0 –size-decimator 4 –frame-decimator 2 –red-threshold 0.4 –green-threshold 0.2 –blue-threshold 1.0 –screenshot”
    and saving to values to /storage/.config/hyperion.config.json I’m trying to take a screenshot using:
    “LD_LIBRARY_PATH=/storage/hyperion/bin /storage/hyperion/bin/hyperion-v4l2 /storage/.config/hyperion.config.json –screenshot”
    but apparently the values are being ignored…
    Any help would be appreciated.

  14. Hi
    If Im ging to follow all your steps in this and in your First tutorial Can i still use xbmc with the ambilight? So Can i switch the hdmi input between the xbmc Mediacenter and for example my ps3 or an other input?

    1. If you use two rpi, one just for capturing the hdmi signal and one just for the mediacenter then you don’t need to configure hyperion for xbmc as shown in my first tutorial. Just switch the hdmi input and you’re fine.

  15. Hi,
    I have a powered HDMI splitter (should be called a duplicater), but when it is connected to the HDMI to AV converter which in turn is connected to the grabber, itself connected to the Raspberry Pi, the TV signal is downscaled to 480 (from 1080p, 720p or whatever).
    When I disconnect the converter or any piece of the chain, the signal to the TV dinamically reverts back to the original resolution.
    I tested plugging the two outputs from the splitter to the TV, and I get two 1080p signals for instance (switching between HDMI1 and HDMI2 on TV). Again, if I plug the splitter output back to the chain that finishes as 480 AV signal, the HDMI that goes to TV is downscaled…

    I understand the problem comes from the HDMI to AV converter. Can you confirm that the Speaka you have bought lets you have 1080p to the TV while enjoying the leds ?
    I saw that the one you bought costs more than 50€. Mine was the cheapest, 12€. I don’t mine paying more to get a correct one, but 50€ seems too much…


  16. Hi Christian,

    thanks for the post :)

    2 questions though:

    1) When I have this setup configured, what about the HDMI output of the Raspberry? I mean when I watch movies coming from the raspberry pi storage? Where does the hdmi out go?…When I put it in the hdmi in of the hdmi splitter, I would have a loop, don’t I?

    2) What about the TV signal? Does this setup cover the TV signal as well?


    1. Hi Marcus.

      1) Rpi HDMI out to HDMI splitter in, splitter out_1 to TV, splitter out_2 to HDMI2AV.
      2) If you use the built-in decoder of the TV then it won’t be able to grab the signal. For that purpose, you’ll need an external decoder and connect it as shown in 1).

      Regards Christian

Leave a Reply

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