I often come across 44 kHz 16 bit lossless songs with True Peak between -0.5dB and 0dB, which is calculated using the recommended EBUR128 of Foobar2000 player. When converting to MP3 using LAME, I see that True Peak changes noticeably, it becomes between+0.5dB and +1.5dB, sometimes even higher. By trial and error, I found that using a preamp of -1.5dB in the conversion chain helps keeping True Peak in MP3 files around 0. But it's a manual method, more suitable when all songs to be converted have no headroom to spare, and if any song has enough headroom on its own, its volume seems to be reduced for nothing. So what is the best course of action here, or am I worrying in vain?
I see the solution was to use MP3Gain app. I tried it and didn't understand how to automate the workflow properly. It allows me to considerably lower the volume of an audio file ('apply Track gain', much like Replaygain does) or raise it without going above zero ('apply Max No-clip gain'). But how to automatically process only clipped MP3 without making the rest of them sound too quiet or too loud? That is, if lossless TP is -1.5dB and MP3 TP is 1.5dB, make the latter slightly below 0, not say -7dB. And if lossless TP is -15dB and MP3 TP is -13.5dB, then do not touch it at all.
For example, LAME 3.99.5 has an option --clip-detect which offers a proper --scale # flag after processing an audio file to eliminate the clipping if one is detected, but, as you may guess, it requires two manual passes.