I recently used the Node.js music-metadata
package to automate file renaming on a large scale. I found that it was selecting a different string to what I expected for the title
field. This turned out to be the result of duplicate ID3v2.4 fields, at least according to the output of music-metadata
(some fields redacted):
[
// These fields are created by Mp3tag
{ id: 'TALB', value: '<string>' },
{ id: 'TPE1', value: '<string>' },
{ id: 'TPE2', value: '<string>' },
{ id: 'TPOS', value: '1/1' },
{ id: 'TCMP', value: '1' },
{ id: 'TIT2', value: '<string: correct title>' },
{ id: 'TRCK', value: '37/37' },
{ id: 'TDRC', value: '2003' },
{
id: 'APIC',
value: {
format: 'image/jpeg',
type: 'Cover (front)',
description: '',
data: <Buffer>
}
},
// These fields already existed
{ id: 'TXXX:major_brand', value: 'M4A' },
{ id: 'TXXX:minor_version', value: '512' },
{ id: 'TXXX:compatible_brands', value: '<string>' },
{ id: 'TIT2', value: '<string: incorrect title>' },
{ id: 'TPE1', value: '<string>' },
{ id: 'TDRL', value: '<string>' },
{
id: 'TXXX:description',
value: "<long string>"
},
{
id: 'TXXX:comment',
value: '<string>'
},
{ id: 'TSSE', value: 'Lavf54.63.104' }
]
music-metadata
is read-only, as far as I can tell, and so cannot be used to programmatically remove these extra fields. I have tried using the field mapping in Mp3tag to add, e.g., a "major_brand" field in an attempt to overwrite or remove the TXXX
fields in the file. Unfortunately, Mp3tag forces "Source" values in the Field Mappings UI to uppercase, which causes a new "TXXX:MAJOR_BRAND" field to be added to the file rather than the replacing of "TXXX:major_brand".
The only way I have found to fix this metadata issue is to use the "Remove Tag" feature in Mp3tag 2–3 times to remove all fields and then add everything back manually. This is, of course, not a great solution.
I don't know whether duplicate fields or lowercase TXXX
labels are even legal in ID3v2.4 or whether software should select the first or last match for a particular field when there are duplicates (Mp3tag selects the first, music-metadata
selects the last). That is, I don't know if this MP3 file can be considered corrupt or not. Either way, it would be good to have a facility in Mp3tag to modify raw fields for each supported format without needing to go through the mapping system or remove every field first. I understand that this would be an advanced feature, but without this there is no way to list every ID3v1, ID3v2.3, ID3v2.4, etc. key and value pair like music-metadata
can. For what it's worth, the "Extended Tags" window currently gives a false impression of being a list of every metadata field in the file, but this isn't the case.
This aside, thank-you for creating a excellent piece of software.