techtalk – Christian Moser It's all about technology

13May/1415

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, I kindly refer you to my previous guide.

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
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...
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.

HDMI capturing setup

 

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.

 

2. Hyperion configuration

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

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. The green lines are most likely from the incomplete driver for my grabber.

screenshot.png

 

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.

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!

Comments (15) Trackbacks (0)
  1. You may actually have been lucky you got the Fushicai UTV007 instead of STK1160. I just got all my parts and been trying to get the STK1160 working decently, but there’s been many issues such as randomly Flashing LED and when it does work there’s about .75 second delay which for the lights is unusable.
    Reading some of the comments on Hyperion’s forum it seems the Fushicai is actually the way to go.

  2. Hi Arnold, I wasn’t aware of that, thanks a lot for the hint! Do you think it’s a driver problem of STK1160 or is it related to Hyperion?

  3. Looks like it was a driver problem, I was able to get it working pretty well using an old kernel 3.6.11+ which had an easycap driver instead of a STK1160 driver. That worked fairly well, was down to about a .25 second delay. It also didn’t crash or randomly flash LEDs. I then tried the opposite and used a bleeding edge kernel build of Raspbian, 3.12.19+. It apparently updated the STK1160 driver and now I’m down to a .1 delay which pretty much looks good.
    I’m still looking to see if It can go any lower though. Compared to AmbiBox which I used before and running on the same computer it’s still noticeably slower. There’s almost 0 delay when it’s being generated on the same computer.

    I’ve ordered a couple more random easycap devices on Amazon to see if I can’t get a UTV007 in the mix and see if there’s a noticeable increase.

  4. Hi Christian. Thank you very much for these instructional posts. I intend to try this out as soon as possible but I was wondering, would it suffice to use an xbox one with a HDMI splitter instead of an AVR. The xbox one has both an HDMI input and output. Thanks once again.

  5. Hi Abbas, well I don’t have a xbox one to test but it should work when you connect the xbox one HDMI output to the HDMI splitter. Then from the splitter directly to the the TV and to the HDMI to composite converter/ USB grabber which will finally lead to the Raspberry Pi.
    This way you should got ambient light for the xbox media as well for the devices connected to the xbox HDMI input.
    Regards

  6. Hi there Christian,
    Interesting post and I am going to set up the ambilight.
    1 question, my I use my old PC as my HTPC. It uses a VGA output to my television. Would this be compatible? And what changes would I have to make?

  7. Well, you have to feed the USB grabber connected to the Rpi with an analog signal from the HTPC. Perhaps your old PC supports simultaneous output of two analog video signals? You could test this with a second analog monitor connected to your HTPC.

  8. Hi,
    any ideas about what to do if you get an all gray image with green stripes from “hyperion-v4l2 –screenshot”? I have absolutly no idea what to do :(

    http://imgur.com/ezp0nmW

    Cheers,
    Matthias

  9. Well, what kind of usb grabber do you have? try “sudo apt-get install v4l-utils, than v4l2-ctl –all”, it should give you detailed output about your grabber.

  10. Hi,

    latest OpenElec testbuilds for Raspberry Pi have the usbtv module included for now on (as of 19-Jun-2014 #0619)!
    https://github.com/OpenELEC/OpenELEC.tv/issues/3140
    http://forum.xbmc.org/showthread.php?tid=192380

    So after that, it’s just a matter of installing Hyperion on Openlec (it also works for the testbuilds following the instructions from https://github.com/tvdzwan/hyperion/wiki/Installation-on-RPi-with-OpenELEC )

    I’m also using a Fushicai UTV007 (ID 1b71:3002) and it now works perfectly.

    It’s now really simple to install and simplify your how to.

    Anyway thank you very much, my ambilight is really awesome thanks to you :-)

    Regards.

  11. Hi, you’re welcome and I’m glad that you enjoy your ambilight experience!

    Yes, it seems they have closed my opened issue but I didn’t have the time to retest it, so thanks for your testing feedback! ;-)
    Regards, Chris

  12. How long is the delay with this solution compared to the XBMC-solution? You don’t happen to have a video showing the colors changes with this setup?

  13. Hi Marcus
    Well, In my opinion the delay is not really noticeable compared to the XBMC solution. I don’t have a video to show yet, but will made one soon. Will upgrade my Rpi xbmc build to the current openelec one, so I’ll be able to test with a more up to date kernel driver for my USB grabber.

  14. Would it be possible for me to use this http://octavainc.com/HDMI%20switch%204×1%20ARC%20port_pro.html with this setup?

  15. If you use an HDMI splitter connected to the output and with this solution, it should work


Leave a comment

No trackbacks yet.