I have been updating my music collection recently, and one thing I noticed is that some of my mp3 files had their metadata in different formats, including ID3v1, ID3v2 and APEv2. I decided to clean them up, leaving only ID3v2, which may not be the best choice from a technical point of view, but it certainly is practical.
In order to remove ID3v1 info from my files (and set ID3v2 tags), I used a simple program, aptly named id3v2, which worked perfectly. However, in the case of APE tags, things were not as easy. After searching for a while, the solution I found was a commandline program called apetag. It does seem to work well when adding or updating tags to files, but if the goal is deleting all traces of APE from the music files, the closest you can get with apetag is to remove the individual tags, but the APEv2 header/footer is left inside the file. Certainly not ideal.
Fortunately, the APEv2 spec is available, and fairly straightforward, so I was able to code a perl script that truly removes the unwanted bytes from the files: apestrip. I tested it as best as I could, but still, use with care.