TheFeshy / mp3utensil

A tool for validating, merging, and splitting mp3 files - focused on badly split and merged audio books.
2 stars 1 forks source link

Identify ID3 v 1 and 1.1 tags #7

Closed TheFeshy closed 10 years ago

TheFeshy commented 10 years ago

Identifying 1 and 1.1 tags should be easy, where they are supposed to be - at the end of a file. But when dealing with badly joined files, or badly tagged files, this isn't always the case. Here are some possible locations:

At the end of the file, in junk data (where it is supposed to be) At the end of arbitrary junk data within the file (where it would be if tagged files were joined by "cat" or the like) At the end of a file overwriting 128 bytes of frame data (where a careless tagger might have tried to add it without changing space figuring it would only corrupt a single end frame) At the end of an arbitrary frame within the file overwriting data (which is what would happen if the case above is joined with "cat")

TheFeshy commented 10 years ago

Identifying tags in arbitrary locations would require a heuristic approach - fortunately ID3v1x tags are amenable to this approach. They have fixed-length, zero-padded fields, so identifying a number of zeroes at the end of the fields would be a strong indicator of a frame.