I have this problem A LOT. Over 20 years I have not been able to get rid of it completely. Part of the problem is that I play only 30" basses and the string tension is less on that scale, so the strings tend to be floppy when I hit them and they clack against the frets.
I do this:
1. Turn the treble down on my instrument and to the clacks don't make it through to the cabinet or mix.
2. Don't use a DI box. I used one once on a video and it was unusable because every single clack made it into the mix.
3. Play softer. Don't pluck the strings as hard.
4. If you want to go through a PA system. I find it's OK if I use my line out from the rear of my amp, or put a microphone on the cabinet.
Hope that helps.
I do this:
1. Turn the treble down on my instrument and to the clacks don't make it through to the cabinet or mix.
2. Don't use a DI box. I used one once on a video and it was unusable because every single clack made it into the mix.
3. Play softer. Don't pluck the strings as hard.
4. If you want to go through a PA system. I find it's OK if I use my line out from the rear of my amp, or put a microphone on the cabinet.
Hope that helps.