It is most possibly the issue with the little black box with capacitors exposed.
You might be able to fix it or can replace just the box.
Switch the boxes and see if the pattern follows to narrow down on the issue.
There is a thread for this titled as "intermittent flickering " or something like that.
LED replacement is a PIA, but that little black box repair is easy. Replacement is even super easy.