Mike Brown - 2012-01-05

There are two kinds of gapless MP3s. The kind produced by LAME's old gapless options is just a single stream chopped into sections on frame boundaries, and you (or the player) are supposed to concatenate them before or during playback. This technique was largely abandoned before it gained much traction. The other, currently popular kind is what LAME produces by default (no special options needed), where each file is a separately encoded stream, with metadata in it telling the player how many delay & padding samples to skip on each end to get the part of the stream that corresponds to the original sample set. This may not be perfectly seamless but is the definition of gapless that people generally want.

If the encoder was LAME, the encoder delay is known, and for CD-sourced material (multiples of 588 samples), the padding can be guessed at, or even confirmed if you have access to the exact track length from the original CD. Otherwise, there's no way to know for sure. If the encoder is unknown, then not even the delay is certain. So I don't think there's really a way to do what you want automatically. Further reading: http://wiki.hydrogenaudio.org/index.php?title=Gapless_playback