Read/capture frames from internal video buffer
#1
Hi guys,

I'm developing an ambilight add-on for Philips Hue lights. My current approach is to call xbmc.RenderCapture(), calculate the average color of the capture, and adjust the room lights to this color. It works great as a proof of concept, but the lights have a slow reaction time. It'll take them 1 second to adjust to the new color. The result is that it "works" but that the color of the lights is 1 second behind on the video stream. The time is spent by the lights. I don't see a way to improve the speed there.

I'm wondering if it's possible to use XBMC's video buffer to work around the problem. While watching a movie, XBMC will buffer the video. What I would like to do is: "Use xbmc.RenderCapture() to get the current frame, but if there is already some stuff in the buffer, use that and return the frame that will be shown 1 second from now".

Is this at all possible? And is it already implemented in the API?

Or, if you have any other work-arounds/suggestions, I'm all ears Smile
Reply
#2
a one second buffer would be 24 to 60 frames, plus you would also have to buffer audio and subtitles.

Reply
#3
Not possible, XBMC holds a buffer of compressed video, the path from decoder to renderer is very short, there are only 2 frames buffered.
Buffering a second of video would require quite a big rewrite of the rendering path, and it would also have to be added for every hardware decoder.
Reply
#4
For a horrifying hack, maybe you could grab the url of the currently playing item and grab it yourself? I sincerely doubt that it would be any faster, and it's 100% a huge PITA with many pitfalls, but if you're desperate....
Reply
#5
Thanks for the replies, it doesn't sound this is the way to go.

Bstrdsmkr: parsing the video stream in the add-on might be an option, but indeed, it doesn't sound very clean.
Reply

Logout Mark Read Team Forum Stats Members Help
Read/capture frames from internal video buffer0