The most thorough method is to eliminate the source of this brightness flicker. That is to use electrolytic capacitor filtering after rectification to completely filter out this AC ripple.
After the electrolytic capacitor is used for filtering, the rectified sine wave is basically smoothed into a waveform close to DC, with only a small ripple, and the larger the electrolytic capacitor's capacity, the smaller the ripple. In other words, the flicker is basically eliminated.