marshcroft
Posts: 23
Joined: Tue Mar 06, 2012 6:37 pm

Re: Boblight possible?

Tue Apr 24, 2012 11:33 pm

I am looking into getting boblight running alongside a Raspberry Pi running a flavor of XBMC, a current work around is to use the Arduino board via a USB, but it looks like this could actually be possible to do with a Gertboard plugged directly onto the Raspberry Pi.

http://forum.xbmc.org/showthre.....tid=116331

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Boblight possible?

Wed Apr 25, 2012 10:29 am

I don't know much about this, but I believe you need a crudely subsampled version of the image being displayed to determine the LED colours.

Currently the ARM doesn't see the decoded video, but an openMAX component could subsample the decoded image and send back the pixels. That would be a full HD image resize every frame which will be more expensive than necessary.

We could possibly add a cheaper option of just pulling out a small set of pixels more slowly - e.g. at 1 frame per second. What data do you need?

Angeenes
Posts: 1
Joined: Sun Jun 24, 2012 10:31 am

Re: Boblight possible?

Sun Jun 24, 2012 10:34 am

Hi, anyone working on that for the pi ?

plfort
Posts: 18
Joined: Tue Jul 03, 2012 11:26 pm
Location: Grenoble

Re: Boblight possible?

Tue Jul 03, 2012 11:36 pm

I've managed to control a strip of lights used in Adalight project (http://www.ladyada.net/products/pixel12mm/), with SPI driver from here http://www.open.com.au/mikem/bcm2835/.

I use the Boblight popen device that send data (float in ASCII) to my program, this one parses data and sends data light to the strip, but it is very flickering ...
I'm not a C/C++ developper and maybe the bcm2835 library is not optimize for the LEDs strip...

An idea is to create a raspberry device for boblight (raspilight ??)

plfort
Posts: 18
Joined: Tue Jul 03, 2012 11:26 pm
Location: Grenoble

Re: Boblight possible?

Fri Jul 06, 2012 7:02 pm

Raspbmc RC3 with boblight : http://www.youtube.com/watch?v=5FRV4z_VOVs
It only works with static background light

pi_vip
Posts: 4
Joined: Tue Jul 03, 2012 11:59 am

Re: Boblight possible?

Sat Aug 04, 2012 8:05 am

is it possible to get it working with dynamic lights ? I've seen on http://forum.xbmc.org/showthread.php?tid=116331&page=43 that the rpi is not using GLES for playback. so no chance with this addon ?

User avatar
nadnerb
Posts: 175
Joined: Sun May 13, 2012 11:22 am

Re: Boblight possible?

Fri Aug 24, 2012 9:39 pm

plfort, have you made any progress on this?
It would be pretty awesome if we could get this running

dsbaars
Posts: 1
Joined: Sat Aug 25, 2012 5:17 pm

Re: Boblight possible?

Sat Aug 25, 2012 5:29 pm

Hi please make sure that you have the following:
  • The LED pixels should have an external power source. You can not connect the pixels to the Raspberry Pi because they draw to much power (You need 1.5 Ampere for 25 pixels, 60mA per RGB LED)
    Connect the Raspberry Pi Ground with the LED pixels ground
    Connect the LED pixel green wire (Clock) to SPI SCK
    Connect the LED pixel yellow wire (Serial Data) to MOSI (NOT MISO)
Then it should work.

The SPI protocol is universal so it should work on the Raspberry Pi. Just make sure your power source is good enough. I

dhead
Posts: 10
Joined: Fri Apr 06, 2012 4:31 am

Re: Boblight possible?

Wed Aug 29, 2012 4:31 pm

This thread is quite confusing, but I don't want to open a new one, so I'll post here.

First of all boblight consist of two parts, the client and the demon.

A client is the machine that its display you want to analyze and send this information to the demon.
For example a client it's a RPi running XBMC, and you want to analyze the video that is played.

A demon is the machine that can receive this information and lights the leds according to it.

My idea is to have RPi running as both the client and the demon.


Getting the RPi act as a demon should be a piece of cake, there's really nothing to it.

Getting the RPi act as a client would require much more development skills.
I'm no developer and I'm a bit linux n00b, but from what I think happens (without really understanding the source code):
Boblight for linux has 3 clients:
1. boblight-X11 for the application that use x-org, maybe xbmc gui, maybe even analyze images.
2. boblight-constant nothing really analyzed, maybe just sending constant color scheme.
3. boblight-v4l this is the client used to analyze video (note the videograbber.cpp file).

(I'm continuing with my guessing)
The RPi has a dedicated video player, omxplayer, to decode video & audio utilizing the openmax api, the v4l library isn't used by omxplayer so the boblight-v4l has no info to analyze.
As Dom mention above to get Boblight client on the RPi you'll need to get the info by using openmax api.

Regards Dom's goodwill and development abilities to help in the matter:
Please have a look at the source files in the library boblight-v4l of the boblight project at http://code.google.com/p/boblight/

Just to make thing clearer:
XBMC boblight addon for linux use the same boblight client as mention above.
I haven't done much research in the matter but there probably more than few of these philips ambilight clones clients, but for linux I believe boblight is the default.

VZoltan
Posts: 179
Joined: Sat Jun 02, 2012 10:00 pm

Re: Boblight possible?

Thu Oct 18, 2012 5:27 pm

plfort wrote:Raspbmc RC3 with boblight : http://www.youtube.com/watch?v=5FRV4z_VOVs
It only works with static background light
Can u give us a "how-to" page with step by step instructions and a picture about leds connecting into the pi, please? (i already have the leds and the pi, but i dont know the connections)


id like to use this, even if it is "only" static light.

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Wed Dec 19, 2012 8:21 am

As far as I see we need an OpenMAX component to plug into the video pipline of omxplayer. I have tried to summarize my thoughts here: http://stackoverflow.com/questions/1394 ... e-to-start .

Who is willing to help?

mc349
Posts: 43
Joined: Fri Jan 06, 2012 5:05 pm

Re: Boblight possible?

Wed Dec 19, 2012 1:59 pm

I've never heard of boblight, but does this link help any?
https://code.google.com/p/boblight/wiki ... spberry_Pi

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Boblight possible?

Wed Dec 19, 2012 2:11 pm

Stasik0 wrote:As far as I see we need an OpenMAX component to plug into the video pipline of omxplayer. I have tried to summarize my thoughts here: http://stackoverflow.com/questions/1394 ... e-to-start .

Who is willing to help?
I'd imagine:

Code: Select all

video_decode->video_schedule->video_splitter->video_render
                                           |->resize
and you can read pixel data out of the resize output port. Possibly...

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Wed Dec 19, 2012 2:59 pm

hi dom,

can i also read the data out of a OMX.broadcom.video_splitter port? Or even out of a render port? Using a separate thread?

I mean as far as I understood, I can not define own OMX components without broadcom's help? Is it correct?

Could you help me a bit on getting into reading ports? Can I read them from ARM memory space? Or are they locked in their own memory area?

Otherwise could you at Broadcom define an additional component which can accept callback functions (is may be actually needed since a sync information may be needed)?

Regards,

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Boblight possible?

Wed Dec 19, 2012 6:38 pm

Stasik0 wrote:can i also read the data out of a OMX.broadcom.video_splitter port? Or even out of a render port? Using a separate thread?

I mean as far as I understood, I can not define own OMX components without broadcom's help? Is it correct?

Could you help me a bit on getting into reading ports? Can I read them from ARM memory space? Or are they locked in their own memory area?

Otherwise could you at Broadcom define an additional component which can accept callback functions (is may be actually needed since a sync information may be needed)?
Read the OpenMAX IL 1.0 spec here:
http://www.khronos.org/openmax/

Then read this:
https://github.com/raspberrypi/firmware ... components

and look at code here:
https://github.com/xbmc/xbmc/tree/maste ... /omxplayer

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Wed Dec 19, 2012 8:51 pm

IL specs are heavy! Just to be curious, is there a way of setting something like "inputBufferWritten" event handler for the rendering element?

There is a Decode call in omxplayer, however it is a bit too early, i need to hook up the buffer of the scheduler or of the renderer.

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Thu Dec 20, 2012 5:57 pm

ok, so now, my plan is to hook up the decoder and mark buffers there. After the marked buffers have reached the renderer I can process them and do everything else.

I changed OMXVideo.cpp part

Code: Select all

      if(demuxer_bytes == 0)
        omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
to

Code: Select all

      if(demuxer_bytes == 0){
        omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
        omx_buffer->hMarkTargetComponent = m_omx_render.GetComponent();
        omx_buffer->pMarkData = m_omx_render.GetComponent();
      }
So as far as I understood the sepcs, an event handler of the renderer should be called by the after a frame is processed by it, however, it does never happen :(

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Fri Dec 21, 2012 9:54 am

Setting buffer marks gives me OMX_ErrorInsufficientResources :(

Code: Select all

typedef struct OMX_MARKTYPE
{
    OMX_HANDLETYPE hMarkTargetComponent;
    OMX_PTR pMarkData;
} OMX_MARKTYPE;
OMX_MARKTYPE mark;
mark.hMarkTargetComponent = m_omx_render.GetComponent();
mark.pMarkData = m_omx_render.GetComponent();
omx_err = m_omx_sched.SendCommand(OMX_CommandMarkBuffer, m_omx_sched.GetInputPort(), &mark);
so i need an another approach for timing :/

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Sat Dec 22, 2012 10:29 am

Hey, don.. I am trying to use an write_still or image_write element to capture frames to ramdrive

Code: Select all

  componentName = "OMX.broadcom.image_write";
  if(!m_omx_write.Initialize(componentName, OMX_IndexParamVideoInit))
    return false;
  
  //setting uri of the image output
  const char* filename = "file:///dev/shm/omxplayer_fb.bmp";

  size_t uri_size = strlen(filename) + 1;
  size_t param_size = sizeof(OMX_PARAM_CONTENTURITYPE) + uri_size - 1;

  write_param = reinterpret_cast<OMX_PARAM_CONTENTURITYPE *>(new char[param_size]);
  OMX_INIT_STRUCTURE(*write_param);

  write_param->nSize = param_size;
  memcpy(write_param->contentURI, filename, uri_size);

  omx_err = m_omx_write.SetParameter(OMX_IndexParamContentURI, &write_param);
  if(omx_err != OMX_ErrorNone)
  {
    CLog::Log(LOGERROR, "%s::%s - error OMX_IndexParamContentURI omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
  }
however setting uri gives me a (0x80001009) hardware error?!

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Sat Dec 22, 2012 3:12 pm

I now tried a different approach of getting data directly out of the splitter port, this works well, however I can not recognize the format of the data... it gives me about 1.5byte per pixel is it RGB 444?

Can I extract RGB values directly out of it?

I tried an RGB conversion like this:

Code: Select all

  OMX_VIDEO_PARAM_PORTFORMATTYPE video_param;
  OMX_INIT_STRUCTURE(video_param);
  video_param.nPortIndex = m_omx_split.GetOutputPort();  
  video_param.eCompressionFormat = OMX_VIDEO_CodingUnused;             
  video_param.eColorFormat = OMX_COLOR_Format16bitBGR565;  
  omx_err = m_omx_split.SetParameter(OMX_IndexParamVideoPortFormat, &video_param);
  if(omx_err != OMX_ErrorNone)
  {
    CLog::Log(LOGERROR, "%s::%s - error OMX_IndexParamVideoPortFormat omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
    return false;
  }
however an error (0x80001005) bad parameter is returned

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Sun Dec 23, 2012 1:57 pm

Hi dom,

it seems to be YUV 420 planar data. Can I make the GPU to convert it to RGB values? I can not connect video_split to image_encode or video_encode directly becoming ports not compatible errors.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6954
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Boblight possible?

Sun Dec 23, 2012 2:31 pm

Stasik0 wrote:it seems to be YUV 420 planar data. Can I make the GPU to convert it to RGB values? I can not connect video_split to image_encode or video_encode directly becoming ports not compatible errors.
I believe you can set:
param->format.video.eColorFormat = OMX_COLOR_Format16bitRGB565.
from a OMX_IndexParamPortDefinition.

If you want more formats you can attach a resize component to outside of splitter (and the resize would probably be useful - you don't really want to send 1920x1080 images to ARM),
That also supports OMX_COLOR_Format32bitARGB8888.

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Sun Dec 23, 2012 11:05 pm

thanks for the hint, i am trying the following

Code: Select all

  m_omx_split.DisablePort(m_omx_split.GetInputPort(), false);

  OMX_PARAM_PORTDEFINITIONTYPE port_image;
  OMX_INIT_STRUCTURE(port_image);
  port_image.nPortIndex = m_omx_split.GetOutputPort();

  omx_err = m_omx_split.GetParameter(OMX_IndexParamPortDefinition, &port_image);

  port_image.format.video.eColorFormat = OMX_COLOR_Format16bitRGB565;
  omx_err = m_omx_split.SetParameter(OMX_IndexParamPortDefinition, &port_image);

  m_omx_split.EnablePort(m_omx_split.GetInputPort(), false);

  omx_err = m_omx_split.SetStateForComponent(OMX_StateExecuting);
  if (omx_err != OMX_ErrorNone)
  {
    CLog::Log(LOGERROR, "COMXVideo::Open error m_omx_split.SetStateForComponent\n");
    return false;
  }
The code gives me an OMX_ErrorIncorrectStateOperation error. The splitter is initialized before and should be in stateLoaded. What am I doing wrong?

Stasik0
Posts: 63
Joined: Tue Dec 18, 2012 6:31 pm

Re: Boblight possible?

Thu Dec 27, 2012 4:18 pm

ok, i kinda got image grabbing working, unfortunately I do not have the LEDs yet. If someone having an RPi and a running boblightd has interest to play a beta-tester - please PM me.

regnets
Posts: 16
Joined: Fri Jan 04, 2013 1:51 pm

Re: Boblight possible?

Fri Jan 04, 2013 2:06 pm

Hi Stasik0,

maybe you should have a look at xbmc.org.

It's a full blown media center which has the ability to install add ons.

It is also available as a bundle with an linux distro (openelec.tv). OpenELEC is able to run on the raspberry pi (http://wiki.openelec.tv/index.php?title ... spberry_Pi).

After it is installed you can extend it with addons. Especially in your case there is an boblightd addon and a boblight client add on which automatically should grab images from the omxplayer (which is used in xbmc) if there were a method implemented which is called "CRenderCapture". And i hope you implemented this method.

It would be cool if you could contact Memphiz from the xbmc.org forum. He is one of the major developers of xbmc and he created the boblight client addon (http://forum.xbmc.org/showthread.php?tid=116331).

Also i started a thread for a feature request that the boblight client should work on the raspberry pi too (only the CRenderCaputure method in omxplayer is missing as far as i know). Maybe you could post your code/experience there. So that memphiz our someone else with the required skills could use it in xbmc.

Thank you in advance

If you have any questions about xbmc/openelec/ambilight feel free to ask.

I would love to see ambilight working on raspberry pi.

Best regards

regnets

Return to “General discussion”