Kodi Community Forum
Release Philips Hue Service & Ambilight - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Service Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=152)
+---- Thread: Release Philips Hue Service & Ambilight (/showthread.php?tid=344886)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


RE: Philips Hue Service & Ambilight - Snapcase - 2019-09-23

@cw-kid  I just released a new version, 0.8.2, which should support TV & disks. You have to make sure to turn on "Other" under video activation. The reason it wasn't working is that TV and discs don't report a video duration so it was conflicting with the minimum time setting, but that's ignored now for "other" videos.

Ambilight was kinda broken in the last version and although I fixed it I'm not too happy with how it looks. I've been playing around with the official Hue Sync app and ScreenBloom. ScreenBloom is written in Python so I'm probably going to be using it as an inspiration in a future version. It works pretty well


RE: Philips Hue Service & Ambilight - DeusXM - 2019-09-24

(2019-09-16, 16:37)Snapcase Wrote: From what I've learnt so far, the limitation is more specifically with Android devices using MediaCodec Surface hardware acceleration. If it does run linux it might run fine, but it depends on the hardware capabilities. Either way it's not something I can do anything about. Try it out at let us know!

If you are running the SPMC fork, adding the below to advancedsettings.xml enables you to use MediaCodec Surface AND Hue at the same time. Potentially this may work for regular Kodi too?
 
Quote:<advancedsettings>
[...]
<video>
<usedroidprojectioncapture>true</usedroidprojectioncapture>
</video>
[...]
</advancedsettings> 



RE: Philips Hue Service & Ambilight - R91g - 2019-09-25

(2019-09-24, 11:42)DeusXM Wrote:
(2019-09-16, 16:37)Snapcase Wrote: From what I've learnt so far, the limitation is more specifically with Android devices using MediaCodec Surface hardware acceleration. If it does run linux it might run fine, but it depends on the hardware capabilities. Either way it's not something I can do anything about. Try it out at let us know!

If you are running the SPMC fork, adding the below to advancedsettings.xml enables you to use MediaCodec Surface AND Hue at the same time. Potentially this may work for regular Kodi too?
 
Quote:<advancedsettings>
[...]
<video>
<usedroidprojectioncapture>true</usedroidprojectioncapture>
</video>
[...]
</advancedsettings> 
I have the same problem with a Xiaomi Mi Box.
In SPMC can add this settings to advancedsettings.xml but this settings with official Kodi 18.4 doesn't works


RE: Philips Hue Service & Ambilight - Snapcase - 2019-09-25

It probably only works with the SPMC fork. From what I've read it will ask for android permissions on launch to be able to take screenshots. It makes sense to not harass everyone with that unless it's for a core feature. Personally I get annoyed if android apps ask for too many permissions. Also it looks like SPMC development has stopped in feb 2018  so although it might work now it's probably not a long term solution. It'll probably break eventually as Kodi & my script evolves but SPMC won't follow along.

At any rate, the ambilight algorithm looks pretty bad at the moment so I'm going to focus on getting that working properly. I wouldn't recommend anyone go through the trouble of trying to get it working on Android until its actually worth using.


RE: Philips Hue Service & Ambilight - cw-kid - 2019-09-26

(2019-09-23, 22:30)Snapcase Wrote: @cw-kid  I just released a new version, 0.8.2, which should support TV & disks. You have to make sure to turn on "Other" under video activation. The reason it wasn't working is that TV and discs don't report a video duration so it was conflicting with the minimum time setting, but that's ignored now for "other" videos.

Ambilight was kinda broken in the last version and although I fixed it I'm not too happy with how it looks. I've been playing around with the official Hue Sync app and ScreenBloom. ScreenBloom is written in Python so I'm probably going to be using it as an inspiration in a future version. It works pretty well

Great I will try it at the weekend when I have time. I also need to look at those addon settings for the daylight issue.


RE: Philips Hue Service & Ambilight - DeusXM - 2019-09-27

(2019-09-25, 17:00)Snapcase Wrote: It probably only works with the SPMC fork. From what I've read it will ask for android permissions on launch to be able to take screenshots. It makes sense to not harass everyone with that unless it's for a core feature. Personally I get annoyed if android apps ask for too many permissions. Also it looks like SPMC development has stopped in feb 2018  so although it might work now it's probably not a long term solution. It'll probably break eventually as Kodi & my script evolves but SPMC won't follow along.

At any rate, the ambilight algorithm looks pretty bad at the moment so I'm going to focus on getting that working properly. I wouldn't recommend anyone go through the trouble of trying to get it working on Android until its actually worth using.
The permissions request is a simple pop-up the first time you load SPMC - afterwards, you don't see it.

I've previously used SPMC with this addition, using the old mpolednik script, and I've found the algorithm reasonably effective (except for credits scenes where it loses it). Apologies for not checking but are you using the same algorithm or did you develop your own?

Great to see someone carrying on active development on this by the way.


RE: Philips Hue Service & Ambilight - Snapcase - 2019-09-27

(2019-09-27, 13:16)DeusXM Wrote: are you using the same algorithm or did you develop your own?

Neither. I changed it to the algorithm used in ScreenBloom but it's only been a couple of days. So far it seems to behave pretty well. For dark scenes like credits it should dim to whatever you have set for the minimum brightness. Let me know if you have feedback - it's tricky to get right but with only my own set up to look at I have no idea how well it works for others.


RE: Philips Hue Service & Ambilight - cw-kid - 2019-10-06

(2019-09-23, 22:30)Snapcase Wrote: @cw-kid  I just released a new version, 0.8.2, which should support TV & disks. You have to make sure to turn on "Other" under video activation. The reason it wasn't working is that TV and discs don't report a video duration so it was conflicting with the minimum time setting, but that's ignored now for "other" videos.

Ambilight was kinda broken in the last version and although I fixed it I'm not too happy with how it looks. I've been playing around with the official Hue Sync app and ScreenBloom. ScreenBloom is written in Python so I'm probably going to be using it as an inspiration in a future version. It works pretty well
The Ambilight works now with Live TV channels in Kodi. Just tried it nice one !


RE: Philips Hue Service & Ambilight - QuincyR - 2019-10-11

(2019-09-27, 16:25)Snapcase Wrote:
(2019-09-27, 13:16)DeusXM Wrote: are you using the same algorithm or did you develop your own?

Neither. I changed it to the algorithm used in ScreenBloom but it's only been a couple of days. So far it seems to behave pretty well. For dark scenes like credits it should dim to whatever you have set for the minimum brightness. Let me know if you have feedback - it's tricky to get right but with only my own set up to look at I have no idea how well it works for others. 
I've been playing around with your plugin and its great. One thing I noticed, was that if i made the frame capture size larger by setting it to "1000" the hue lights have less lag (down to about a second). When I set it to the smallest size of 150, the lag was about 3 sec. Anyway we can make this allow for up to 1920, or even disable the frame capture to improve performance using Hue lights?


RE: Philips Hue Service & Ambilight - QuincyR - 2019-10-11

(2019-10-11, 05:15)QuincyR Wrote:
(2019-09-27, 16:25)Snapcase Wrote:
(2019-09-27, 13:16)DeusXM Wrote: are you using the same algorithm or did you develop your own?

Neither. I changed it to the algorithm used in ScreenBloom but it's only been a couple of days. So far it seems to behave pretty well. For dark scenes like credits it should dim to whatever you have set for the minimum brightness. Let me know if you have feedback - it's tricky to get right but with only my own set up to look at I have no idea how well it works for others.  
I've been playing around with your plugin and its great. One thing I noticed, was that if i made the frame capture size larger by setting it to "1000" the hue lights have less lag (down to about a second). When I set it to the smallest size of 150, the lag was about 3 sec. Anyway we can make this allow for up to 1920, or even disable the frame capture to improve performance using Hue lights? 
Also I'm noticing my hue light are generally the same color, is there something I can do within the addon to pick a different sample area of the screen?


RE: Philips Hue Service & Ambilight - Snapcase - 2019-10-11

Hi @QuincyR 

Let me give you a bit more detail on how that works, I didn't necessarily explain it in detail in this thread.

The capture size changes how large the rendered image is, but it doesn't take a sample of a corner of the screen. It preserves the aspect ratio and retains the whole image. It's more like changing your resolution to 480p instead of 1080p. There's less data, but the whole screen is represented.

In my testing I found that the lower it is, the faster the colours are analyzed. For example, in my setup, a capture size of 400 is analyzed in 40-50ms. I found that updating the lights about 4 times per second is a good balance between accuracy and annoying strobing, so in my setup my interval time is 200 and the analysis takes about 40-50 so in total the ~250ms time gives me the effect I like. 

That said, that's my preference. If your lights are more in your peripheral vision or too direct, faster speeds might be more annoying. However, I would slow it down using the interval. This way, it changes how often it checks, but there will be less delay between when it grabs a frame updates your lights, which means less lag.

What I would suggest it that you turn on "performance logging" under the Advanced category of addon settings. This will write a log telling you exactly how long the colour analysis takes and you can tune your setup with this. Don't leave it on or it will spam your logs and eventually fill your storage!

All that said, I can easily change the settings to let you use a larger capture size. I'll include that in the next version.

As for the colours, it takes an average colour of the full screen. It really depends on the kind of content you're watching. It's hard to know from your description what's happening. Could you tell me more about how it's behaving?


RE: Philips Hue Service & Ambilight - QuincyR - 2019-10-11

(2019-10-11, 14:45)Snapcase Wrote: Hi @QuincyR 

Let me give you a bit more detail on how that works, I didn't necessarily explain it in detail in this thread.

The capture size changes how large the rendered image is, but it doesn't take a sample of a corner of the screen. It preserves the aspect ratio and retains the whole image. It's more like changing your resolution to 480p instead of 1080p. There's less data, but the whole screen is represented.

In my testing I found that the lower it is, the faster the colours are analyzed. For example, in my setup, a capture size of 400 is analyzed in 40-50ms. I found that updating the lights about 4 times per second is a good balance between accuracy and annoying strobing, so in my setup my interval time is 200 and the analysis takes about 40-50 so in total the ~250ms time gives me the effect I like. 

That said, that's my preference. If your lights are more in your peripheral vision or too direct, faster speeds might be more annoying. However, I would slow it down using the interval. This way, it changes how often it checks, but there will be less delay between when it grabs a frame updates your lights, which means less lag.

What I would suggest it that you turn on "performance logging" under the Advanced category of addon settings. This will write a log telling you exactly how long the colour analysis takes and you can tune your setup with this. Don't leave it on or it will spam your logs and eventually fill your storage!

All that said, I can easily change the settings to let you use a larger capture size. I'll include that in the next version.

As for the colours, it takes an average colour of the full screen. It really depends on the kind of content you're watching. It's hard to know from your description what's happening. Could you tell me more about how it's behaving?
Hi Snapcase, 

Thanks for the reply, I will turn on logging to check the response time. I was just doing an eyeball test when it seemed to keep up with the animated movie faster. 

For the average color i see what you mean now. Would it be possible to allow for the average color on top/left/right/bottom or center? I used the pc hue app for an example, when its playing video it seems to grab different colors from the general area setup within the entertainment screen. So when you play the same video on PC versus Kodi, its pretty noticeable that colors are missing. or pull in the height/location info from the hue app?


RE: Philips Hue Service & Ambilight - Snapcase - 2019-10-11

(2019-10-11, 16:41)QuincyR Wrote: Hi Snapcase, 

Thanks for the reply, I will turn on logging to check the response time. I was just doing an eyeball test when it seemed to keep up with the animated movie faster. 

For the average color i see what you mean now. Would it be possible to allow for the average color on top/left/right/bottom or center? I used the pc hue app for an example, when its playing video it seems to grab different colors from the general area setup within the entertainment screen. So when you play the same video on PC versus Kodi, its pretty noticeable that colors are missing. or pull in the height/location info from the hue app? 

Actually don't bother about the performance logging for now, I thought of a better way. I'm working on a new version and will update this thread later today with some updates for you.


RE: Philips Hue Service & Ambilight - QuincyR - 2019-10-11

(2019-10-11, 18:06)Snapcase Wrote:
(2019-10-11, 16:41)QuincyR Wrote: Hi Snapcase, 

Thanks for the reply, I will turn on logging to check the response time. I was just doing an eyeball test when it seemed to keep up with the animated movie faster. 

For the average color i see what you mean now. Would it be possible to allow for the average color on top/left/right/bottom or center? I used the pc hue app for an example, when its playing video it seems to grab different colors from the general area setup within the entertainment screen. So when you play the same video on PC versus Kodi, its pretty noticeable that colors are missing. or pull in the height/location info from the hue app? 

Actually don't bother about the performance logging for now, I thought of a better way. I'm working on a new version and will update this thread later today with some updates for you. 

Oh Awesome! I can't wait! Smile

-Q


RE: Philips Hue Service & Ambilight - Snapcase - 2019-10-11

Hi

I just released a new version (v.0.9.5), you can get it at the link below or update add-ons in Kodi if you're using the repo.

You can now can see the performance directly in the add-on settings. If you run a video for a minute or so and stop it, you can then go to settings -> ambilight, and see the average time it takes to analyze an image. If you play around with the capture size, you'll be able to see the delay right there and find the value that works best for you. It will always update with the last run.

As for the colours, I'm not sure understand what you're suggesting, but I played around with the saturation option to make it work properly. I watched a couple different clips and found that for me 1.5 is enough to boost the colour without making talk shows and newscasts look too weird. If you start with 2 you should see an obvious difference, and then you can adjust it up and down to your preference.

I generated some example images to get a sense of what exactly it looks like. Too high and you lose too many darks and any accuracy.