Prevent Clipping and Hum in class d amplifier
Class D amps are extremely susceptible to hum on the power feeds to the amplifier. This is because the MOSFETs that do the switching are switching hard against the power rails and any AC voltage superimposed on these rails (ripple aka hum) gets transferred to the speaker.

Best idea is to add more decoupling capacitors to the power supply that feeds the class D amplifier. Regards using a compressor, yes that would work but you will likely lose some dynamics of your sound when played at more moderate levels - can you tolerate this?

The mp3 player lead - this sounds like the normal situation you would get an any amplifier that uses an unbalanced input amplifier (as most are).