ShiromMakkad / LedFxDocker

A Docker Container for LedFx.
56 stars 19 forks source link

improving performance on ARM devices #24

Open NenuSB opened 8 months ago

NenuSB commented 8 months ago

I found performance very poor on Raspberry Pi3B, Nanopi Neo3 and NanopiR4S. After a few minutes the animation would lag severely behind the audio (Squeezebox/LMS). After longer times (10 min or so), when the audio was stopped, the animation would continue for several more seconds. Testing more extensively on the R4S running Armbian and docker, I found that running the container 'privileged' strongly improves performance. Limiting to specific CPU's also seems to help. This is my adjusted compose file:

--------------------------------------
version: '2'

services:
  ledfx:
    image: shirom/ledfx
    container_name: ledfx
    environment: 
      - FORMAT=-r 44100 -f S16_LE -c 2
      - SQUEEZE=1
    ports:
      - 8888:8888
    network_mode: host
    volumes:
      - ./ledfx-config:/app/ledfx-config
      - ~/audio:/app/audio
    cpuset: '4,5'
    privileged: true

--------------------------------------

in non-privileged mode, the performance was 'best' (but still very poor) when limiting to only 1 CPU. With the compose above, it is now running OK for 7 WLED devices with about 1500 pixels in total.

ShiromMakkad commented 3 weeks ago

This is super cool. I'm hoping to have my LEDs back up within the next few weeks and I can work through the backlog.

I also observed poor performance on my 3B+, worse than I'd expect. I was able to solve the audio/animation async by essentially delaying the audio. The balenasound repo has that working. Problem is, the delay could get as bad as 10+ seconds so if you pause or skip a song, you'd have to wait a while.

Thanks for the tip.