awawa-dev / HyperHDR

Highly optimized open source ambient lighting implementation based on modern digital video and audio stream analysis for Windows, macOS and Linux (x86 and Raspberry Pi / ARM).
http://www.hyperhdr.eu/
MIT License
1.05k stars 110 forks source link

Minor issues on Arch Linux #815

Closed luigir-it closed 4 months ago

luigir-it commented 5 months ago

Steps to reproduce

During the installation process, there was an issue with the hostname command, and the output had some weird characters, proabably due to some colors not rendering properly in the terminal.

Stopping HyperHDR daemon: systemd
(1/1) installing HyperHDR                                                                   [------------------------------------------------------] 100%
hostname: invalid option -- 'I'
Try 'hostname --help' or 'hostname --usage' for more information.
Extracting LUT table...
removed '/usr/share/hyperhdr/lut/lut_lin_tables.tar.xz'
Init daemon: GUI detected (service is NOT enabled by default, you can run HyperHDR as an application or service with 'systemctl enable (and next: start)hyperhdr@luigi.service')
Install HyperHDR desktop icons

 +-----------------------------------------------------------------------+
 |                 \033[32;1mHyperHDR has been installed/updated!\033[0m                  |
 +-----------------------------------------------------------------------+
 |  For configuration, visit with your browser:              :8090       |
 |  If already used by another service try:              :8091           |
 |  Start the service: sudo systemctl start hyperhdr@luigi               |
 |  Stop the service: sudo systemctl stop hyperhdr@luigi                 |
 |  Troubleshooting? Run HyperHDR manually: \033[37;1m/usr/bin/hyperhdr\033[0m            |
 +-----------------------------------------------------------------------+
 |  Service is NOT enabled by default for GUI or non-systemd OS          |
 +-----------------------------------------------------------------------+
 |  Webpage: \033[36;1mhttps://hyperhdr.eu\033[0m                                         |
 |  GitHub: \033[36;1mhttps://github.com/awawa-dev/HyperHDR\033[0m                        |
 +-----------------------------------------------------------------------+
Optional dependencies for HyperHDR

Moreover, the system tray icon is not showing when using the systemd unit (but is shown if I run hyperhdr from terminal)

System

HyperHDR 20 - Arch Linux (6.6 lts kernel); coming from v19

awawa-dev commented 4 months ago

Hi

Moreover, the system tray icon is not showing when using the systemd unit (but is shown if I run hyperhdr from terminal)

That's by design, only when HyperHDR is run as a GUI application it's able to display a systray (BTW the systray has changed recently and it's using ayatana-appindicator3/gtk3 so you are welcome to test it). It would be very undesirable and dangerous if daemon services had access to the user's desktop.

luigir-it commented 4 months ago

the systray has changed recently and it's using ayatana-appindicator3/gtk3 so you are welcome to test it

Sure, are you planning to release a new version soon? The current systray has a problem: the effects section is not scrollable, causing it to take up more than the entire screen height. I'm not sure if this issue is due to the systray itself or a misconfiguration with GTK, as I'm not using a preconfigured desktop environment.

Additionally, I noticed that the music effects do not work properly. The lights start when I play something, but they continue even after the music has stopped. It seems like HyperHDR is sending too much data to the LEDs. If I pause the music for a few seconds and then resume, after some time the LEDs turn off briefly and then they too resume their activity. PipeWire screen grabbing works as intended (Max. stream width: 860@25fps, 115200 baudrate).

It would be very undesirable and dangerous if daemon services had access to the user's desktop.

Regarding daemon services accessing the user's desktop, why would this be undesirable and dangerous? Can you explain or provide a resource? The recent xz bug has made me more curious about security and best practices.

awawa-dev commented 4 months ago

Sure, are you planning to release a new version soon? The current systray has a problem: the effects section is not scrollable, causing it to take up more than the entire screen height. I'm not sure if this issue is due to the systray itself or a misconfiguration with GTK, as I'm not using a preconfigured desktop environment.

The old taskbar is powered by QT and has some of their "magic" in it. They probably also use GTK or something similar at some stage (BTW Systray API in Linux is a mess and they are just starting to talk about unification between Plasma/Gnome, meanwhile GTK4 broke compatibility with ayatana-appindicator3). I'm not saying the new one is better (but it has a new feature like instance selection), but it uses a different low-level API that we can control to some extent.

Additionally, I noticed that the music effects do not work properly. The lights start when I play something, but they continue even after the music has stopped. It seems like HyperHDR is sending too much data to the LEDs. If I pause the music for a few seconds and then resume, after some time the LEDs turn off briefly and then they too resume their activity. PipeWire screen grabbing works as intended (Max. stream width: 860@25fps, 115200 baudrate).

I don't think music effects have a very high render rate, but it's probably higher than Pipewire (rather low capturing rate only when the screen has changed). But that's probably too much for the 115200 baud Adalight device. Generally, it is recommended to use one of our projects, e.g. HyperSerialPico, which reaches easily around 4Mb. For your device and for example 250 RGB LEDs (RGBW requires even more bandwidth) is: 250 3 (bytes) (8 bits) = 6000 bits, so 115200/6000 ~ 19 FPS is a super optimal assumption, but ex Arduino (one very slow core) takes some time to render the received frame, so 19FPS will never be achievable in such conditions. Here you have this arrangement of "holes" in which Arduino receives data and prepare buffer ("black" section on the screenshot) to emulate Neopixel protocol which is kind of tricky and then starts to render the frame ("white" section), regardless of the full saturation of communication with the PC (and here Arduino uses even higher speed of 500 000 bauds):

207443059-0ef8bc71-0a5d-4faa-bab7-f313d1cb6ed6

from https://github.com/awawa-dev/HyperSerialEsp8266

luigir-it commented 4 months ago

Generally, it is recommended to use one of our projects, e.g. HyperSerialPico, which reaches easily around 4Mb.

Yes, I should probably upgrade my current setup (old ATmega328p with ws2812b) for something more performant and maybe switch to a strip with white channel, since I can calibrate all I want but when the brightness is down it looks off again.

Today I had some spare time so I read a lot of resources in here. I was wondering, what are the benefits of driving your leds @100hz (like in the case of 300leds in parallel mode with HyperSerialPico firmware) if the capturing source is usually @24hz or @60hz? The only scenario I can think is when you play videogames, but if you're playing high framerate videogames I guess you're attention is not on the LEDs.

awawa-dev commented 4 months ago

Yes, video source is usually 24Hz. But there is another extremely important issue: smoothing. This component of HyperHDR that creates a smooth transition between frames. It generates much more intermediate frames, so you need about 3 to 4 times higher framerate on the output than the source framerate.

awawa-dev commented 4 months ago

Yes, I should probably upgrade my current setup (old ATmega328p ...

Depending on the UART, there is a chance that this ATmega328p will be able to reach 500,000 baud. It should be enough for a musical effect and a small setup. You can try updating the Arduino sketch first.

luigir-it commented 4 months ago

Yes, video source is usually 24Hz. But there is another extremely important issue: smoothing. This component of HyperHDR that creates a smooth transition between frames. It generates much more intermediate frames, so you need about 3 to 4 times higher framerate on the output than the source framerate.

Right know I'm recording at 30fps, and smoothing is on @25hz and 50ms time (it's low because I like the update to be quite snappy). Since captured frames =~ sent frames then how does the smoothing work in this scenario? Because if I turn it off I definitely see a difference; that colors change, well, not smoothly.

there is a chance that this ATmega328p will be able to reach 500,000 baud

Yea mine won't go over 115200, I've already tried.

awawa-dev commented 4 months ago

Right know I'm recording at 30fps, and smoothing is on @25hz and 50ms time (it's low because I like the update to be quite snappy).

So it does down-sampling and still transitions smoothly depending on the smoothing time. Unfortunately, sound effects completely ignore the default smoothing unit (they have their own fast "smoothing" implemented depending on the effect, but with no output rate control) because we want to get the most responsive response to the music possible.

awawa-dev commented 4 months ago

By the way, the output of sound effects is around ~20 Hz, so probably PipeWire's capture-to-output also has insufficient bandwidth (but PipeWire only sends the captured frame when the screen has changed and the capture application has handled the previous frame). Try to enable continues output in the smoothing then probably Pipewire to LED processing will start to lag.

luigir-it commented 4 months ago

Since it does down-sampling, does it make sense to lower the capturing screen refresh rate? Or may it introduce lag? I tried with 20fps and don't notice much of a difference.

Anyway even with continuous output turned on, there isn't lag. So it's weird that sound effect lags @20Hz

awawa-dev commented 4 months ago

In light source tab, set output to LED debug (file), just remember set refresh rate to 0 (if smoothing is disabled) and enable timestamps there. You will see the real output.

luigir-it commented 4 months ago

I'm sorry, where is the "light source" tab? I can enable logs in the "General settings" tab if that's what you mean.

And the logs says dropped=0 2024-05-21T15:33:25.259Z [PERFORMANCE] [INSTANCE0: FPS = 20.00, processed = 1201], [LED0: FPS = 25.00, send = 1500, processed = 1500, dropped = 0]

awawa-dev commented 4 months ago

AKA LED hardware, 3th from the top

luigir-it commented 4 months ago

Here's a few timestamps, how can I interpret the numbers?


2024-05-21T15:45:49.284 | +40.2 [{55,60,46}{55,59,46}{50,57,45}{50,57,45}{50,57,45}{51,57,45}{52,57,45}{48,55,43}{48,55,44}{49,56,44}{49,55,44}{50,56,44}{53,59,46}{64,67,50}{65,69,51}{55,62,48}{54,61,47}{51,57,45}{50,57,44}{50,56,44}{48,55,43}{58,61,45}{53,56,42}{52,60,48}{51,61,49}{50,60,48}{50,60,48}{49,59,48}{49,59,48}{49,59,48}{50,59,48}{52,60,48}{53,60,48}{52,61,49}{53,62,50}{57,65,51}{53,60,46}{55,63,50}{96,101,84}{64,67,49}{73,69,52}{125,105,71}{118,101,66}{75,70,48}{129,109,77}{137,129,90}{137,108,91}{138,114,98}{132,109,76}{123,110,87}{115,124,106}{82,90,66}{64,64,44}{64,65,46}{67,62,40}{72,63,42}{68,65,46}{58,59,39}{60,63,45}{63,64,44}{57,58,40}{69,67,47}{90,89,71}{123,130,125}{124,134,127}{119,127,125}{118,129,121}{98,106,90}{88,117,93}{65,66,45}{68,68,44}{77,73,47}{76,75,52}{75,66,43}{86,79,54}{91,78,54}{92,82,55}{108,100,69}{96,72,46}{77,69,46}{77,73,52}{75,63,40}{80,76,52}{79,72,50}{59,56,37}{69,70,49}{71,64,43}{98,96,68}{99,98,72}{116,92,58}{118,99,62}{79,83,64}{74,78,56}{130,92,74}{70,77,61}{87,95,78}{78,84,67}{79,86,70}{80,86,71}{72,79,64}{70,77,62}{67,74,59}{60,67,52}{59,66,52}{59,66,52}{58,66,52}{62,69,53}{63,69,53}{90,74,55}{94,86,61}{73,63,51}{63,55,45}{73,66,52}{72,73,54}{68,79,64}{69,75,59}{71,77,61}{63,69,54}{72,78,62}{61,68,53}{59,65,52}{62,67,53}{63,68,54}{56,60,47}{54,58,45}{51,57,44}{50,56,44}{51,57,45}{52,59,46}{51,58,45}{52,57,45}{51,57,44}{49,56,44}{51,57,45}{54,59,45}]
2024-05-21T15:45:49.324 | +40.1 [{55,60,46}{55,59,46}{50,57,45}{50,57,45}{50,57,45}{51,57,45}{52,57,45}{48,55,43}{48,55,44}{49,56,44}{49,55,44}{50,56,44}{53,59,46}{64,67,50}{65,69,51}{55,62,48}{54,61,47}{51,57,45}{50,57,44}{50,56,44}{48,55,43}{58,61,45}{53,56,42}{52,60,48}{51,61,49}{50,60,48}{50,60,48}{49,59,48}{49,59,48}{49,59,48}{50,59,48}{52,60,48}{53,60,48}{52,61,49}{53,62,50}{56,64,50}{57,64,49}{52,70,52}{91,102,81}{64,67,49}{73,69,52}{125,107,72}{118,103,68}{75,70,48}{129,109,77}{137,129,90}{137,108,91}{138,114,98}{132,109,76}{123,109,87}{113,123,105}{82,89,65}{64,64,44}{64,65,46}{67,62,40}{72,63,42}{68,65,46}{58,59,39}{60,63,45}{63,64,44}{57,58,40}{69,67,47}{90,89,71}{123,130,125}{124,134,127}{119,127,125}{118,129,121}{98,106,90}{88,117,93}{65,66,45}{68,68,44}{77,73,47}{76,75,52}{75,66,43}{86,79,54}{91,78,54}{92,82,55}{108,100,69}{96,72,46}{77,69,46}{77,73,52}{75,63,40}{80,76,52}{79,72,50}{59,56,37}{69,70,49}{71,64,43}{98,96,68}{99,98,72}{117,93,58}{118,100,62}{79,83,64}{74,78,56}{130,92,74}{70,77,61}{87,95,78}{78,84,67}{79,86,70}{80,86,71}{72,79,64}{70,77,62}{67,74,59}{60,67,52}{59,66,52}{59,66,52}{58,66,52}{62,69,53}{63,69,53}{90,74,55}{94,86,61}{73,63,51}{63,55,45}{73,66,52}{72,73,54}{68,79,64}{69,75,59}{71,77,61}{63,69,54}{72,78,62}{61,68,53}{59,65,52}{62,67,53}{63,68,54}{56,60,47}{54,58,45}{51,57,44}{50,56,44}{51,57,45}{52,59,46}{51,58,45}{52,57,45}{51,57,44}{49,56,44}{51,57,45}{54,59,45}]
2024-05-21T15:45:49.364 | +39.2 [{55,60,46}{55,59,46}{50,57,45}{50,57,45}{50,57,45}{51,57,45}{52,57,45}{48,55,43}{48,55,44}{49,56,44}{49,55,44}{50,56,44}{53,59,46}{64,67,50}{65,69,51}{55,62,48}{54,61,47}{51,57,45}{50,57,44}{50,56,44}{48,55,43}{58,61,45}{53,56,42}{52,60,48}{51,61,49}{50,60,48}{50,60,48}{49,59,48}{49,59,48}{49,59,48}{50,59,48}{52,60,48}{53,60,48}{52,61,49}{53,62,50}{55,63,49}{65,71,56}{48,81,53}{86,104,79}{64,67,49}{73,69,52}{125,108,72}{118,105,69}{75,70,48}{129,109,77}{137,129,90}{137,107,90}{138,114,97}{132,108,76}{122,108,87}{111,123,104}{81,89,65}{64,64,44}{64,65,46}{67,62,40}{72,63,42}{68,65,46}{58,59,39}{60,63,45}{63,64,44}{57,58,40}{69,67,47}{90,89,71}{123,130,125}{124,134,127}{119,127,125}{118,129,121}{98,106,90}{88,117,93}{65,66,45}{68,68,44}{77,73,47}{76,75,52}{75,66,43}{86,79,54}{91,78,54}{92,82,55}{108,100,69}{96,72,46}{77,69,46}{77,73,52}{75,63,40}{80,76,52}{79,72,50}{59,56,37}{69,70,49}{71,64,43}{98,96,68}{98,98,72}{117,95,58}{118,101,62}{79,83,64}{74,78,56}{130,92,74}{70,77,61}{87,95,78}{78,84,67}{79,86,70}{80,86,71}{72,79,64}{70,77,62}{67,74,59}{60,67,52}{59,66,52}{59,66,52}{58,66,52}{62,69,53}{63,69,53}{90,74,55}{94,86,61}{73,63,51}{63,55,45}{73,66,52}{72,73,54}{68,79,64}{69,75,59}{71,77,61}{63,69,54}{72,78,62}{61,68,53}{59,65,52}{62,67,53}{63,68,54}{56,60,47}{54,58,45}{51,57,44}{50,56,44}{51,57,45}{52,59,46}{51,58,45}{52,57,45}{51,57,44}{49,56,44}{51,57,45}{54,59,45}]
2024-05-21T15:45:49.404 | +40.2 [{55,60,46}{55,59,46}{50,57,45}{50,57,45}{50,57,45}{51,57,45}{52,57,45}{48,55,43}{48,55,44}{49,56,44}{49,55,44}{50,56,44}{53,59,46}{64,67,50}{65,69,51}{55,62,48}{54,61,47}{51,57,45}{50,57,44}{50,56,44}{48,55,43}{58,61,45}{53,56,42}{52,60,48}{51,61,49}{50,60,48}{50,60,48}{49,59,48}{49,59,48}{49,59,48}{50,59,48}{52,60,48}{53,60,48}{52,61,49}{53,62,50}{55,63,49}{69,75,59}{47,88,53}{84,105,79}{64,67,49}{73,69,52}{125,108,72}{118,105,69}{75,70,48}{129,109,77}{137,129,90}{137,107,90}{138,114,97}{132,108,76}{122,108,87}{111,123,104}{81,89,65}{64,64,44}{64,65,46}{67,62,40}{72,63,42}{68,65,46}{58,59,39}{60,63,45}{63,64,44}{57,58,40}{69,67,47}{90,89,71}{123,130,125}{124,134,127}{119,127,125}{118,129,121}{98,106,90}{88,117,93}{65,66,45}{68,68,44}{77,73,47}{76,75,52}{75,66,43}{86,79,54}{91,78,54}{92,82,55}{108,100,69}{96,72,46}{77,69,46}{77,73,52}{75,63,40}{80,76,52}{79,72,50}{59,56,37}{69,70,49}{71,64,43}{98,96,68}{98,98,72}{117,95,58}{118,101,62}{79,83,64}{74,78,56}{130,92,74}{70,77,61}{87,95,78}{78,84,67}{79,86,70}{80,86,71}{72,79,64}{70,77,62}{67,74,59}{60,67,52}{59,66,52}{59,66,52}{58,66,52}{62,69,53}{63,69,53}{90,74,55}{94,86,61}{73,63,51}{63,55,45}{73,66,52}{72,73,54}{68,79,64}{69,75,59}{71,77,61}{63,69,54}{72,78,62}{61,68,53}{59,65,52}{62,67,53}{63,68,54}{56,60,47}{54,58,45}{51,57,44}{50,56,44}{51,57,45}{52,59,46}{51,58,45}{52,57,45}{51,57,44}{49,56,44}{51,57,45}{54,59,45}]
2024-05-21T15:45:49.444 | +40.2 [{55,60,46}{55,59,46}{50,57,45}{50,57,45}{50,57,45}{51,57,45}{52,57,45}{48,55,43}{48,55,44}{49,56,44}{49,55,44}{50,56,44}{53,59,46}{64,67,50}{65,69,51}{55,62,48}{54,61,47}{51,57,45}{50,57,44}{50,56,44}{48,55,43}{58,61,45}{53,56,42}{52,60,48}{51,61,49}{50,60,48}{50,60,48}{49,59,48}{49,59,48}{49,59,48}{50,59,48}{52,60,48}{53,60,48}{52,61,49}{53,62,50}{54,62,47}{81,86,70}{44,101,57}{81,109,78}{64,67,49}{73,69,52}{125,109,73}{118,107,70}{75,70,48}{129,109,76}{137,129,90}{137,107,90}{138,114,97}{132,108,76}{121,108,87}{110,123,103}{80,89,64}{64,64,44}{64,65,46}{67,62,40}{72,63,42}{68,65,46}{58,59,39}{60,63,45}{63,64,44}{57,58,40}{69,67,47}{90,89,71}{123,130,125}{124,134,127}{119,127,125}{118,129,121}{98,106,90}{87,116,93}{65,66,45}{68,68,44}{77,73,47}{76,75,52}{75,66,43}{86,79,54}{91,78,54}{92,82,55}{108,100,69}{96,72,46}{77,69,46}{77,73,52}{75,63,40}{80,76,52}{79,72,50}{59,56,37}{69,70,49}{71,64,43}{98,96,68}{98,98,72}{118,96,58}{118,102,62}{79,83,64}{74,78,56}{130,92,74}{70,77,61}{87,95,78}{78,84,67}{79,86,70}{80,86,71}{72,79,64}{70,77,62}{67,74,59}{60,67,52}{59,66,52}{59,66,52}{58,66,52}{62,69,53}{63,69,53}{90,74,55}{94,86,61}{73,63,51}{63,55,45}{73,66,52}{72,73,54}{68,79,64}{69,75,59}{71,77,61}{63,69,54}{72,78,62}{61,68,53}{59,65,52}{62,67,53}{63,68,54}{56,60,47}{54,58,45}{51,57,44}{50,56,44}{51,57,45}{52,59,46}{51,58,45}{52,57,45}{51,57,44}{49,56,44}{51,57,45}{54,59,45}]
awawa-dev commented 4 months ago

+40.2 => 40ms so around 25fps

luigir-it commented 4 months ago

By the way I don't use the music effects, but If you need some test let me know. If you say that sound is captured at ~20hz and my system is not bottle-necking, then the issue must be elsewhere.

awawa-dev commented 4 months ago

You can try music effects and see the output in the logs.

luigir-it commented 4 months ago

I was going to but yesterday I updated the system and now I got this error

hyperhdr: /usr/share/hyperhdr/bin/../lib/libssl.so.3: version `OPENSSL_3.3.0' not found (required by /usr/lib/libcurl.so.4)

Sorry, this thread is becoming a mess (even though there are info that I think could be useful to others in respect to how HyperHDR works). For the music effect issue I'll file another bug report.