[Flac] Duplicate Tag
brianw
brianw at audiobanshee.com
Mon Jan 20 23:00:51 UTC 2025
Hi Dave,
One problem is that you're using dBpoweramp to remove the tag, and there's no guarantee that dBpoweramp will do the right thing. The way it's coded, removing a tag removes all duplicates. In fact, most specifications do not officially allow duplicate tags, even though they're technically possible in the file. dBpoweramp is not necessarily wrong in removing all tags that match "SONG RATING" - another detail is that almost all system which allow removing data will only match on the tag name, not the tag value, so there's no guarantee that all software will perform the same way with duplicate tags.
I see that you also tried the metaflac --remove-tag argument, and it does the same thing. In my experience, this is entirely within reason. Hardly any software requires you do specify that value that you want to remove when removing a tag. You'll not that --remove-tag only provides the tag name, not the tag value, so there would be no way for you to pick which one is deleted.
In your specific case, I think that the best approach is to remove all duplicates and then add only the tag that you desire. You could potentially script this, or use the FLAC library to write a custom piece of software that does exactly what you need. If you write your own custom tool, then you can provide arguments for both the tag name and the tag value, and then your tool could only delete one tag and not any other.
Brian
p.s. It's actually quite challenging to describe a file format so precisely that there is no room for different software developers to interpret it differently. In this example, duplicate tags are probably not mentioned in the official spec (I haven't double-checked that - just guessing) and there's certainly no specification on which tag to remove when there are duplicates.
On Jan 20, 2025, at 12:47 PM, Dave B wrote:
> Thank for the replay Brian.
>
> My intent is to remove a “custom” tag that inadvertently ended up with a with the space in it’s name (Song Rating) and replace it with a tag with no space (SongRating).
> My working file is WorkingMan.flac
>
> If I run the metaflac command:
> metaflac --show-tag="Song Rating" --show-tag=SongRating WorkingMan.flac
> I see the following:
> Note there is a duplicate tag (one with a value and one with no value). Case explained to me that a duplicate tag is not necessarily unwanted.
> <image.png>
> From within dBpoweramp I deleted the SONG RATING tag (2nd from the bottom)
> <image.png>
>
> Then re-run the same metaflac command
> metaflac --show-tag="Song Rating" --show-tag=SongRating WorkingMan.flac
> I now see:
> <image.png>
>
> That not only removed the tag that I actually wanted to delete, it also removed the duplicated tag that had no value.
> …I must say I am confused.
> So now the question begs to be asked. If there are 2 tags, or more, with the same name. One with a value and one without, or for that matter they both have values and you want to remove a specific one. How would I do that. If I use the metaflac command:
> metaflac --remove-tag=SongRating WorkingMan_Copy.flac
> it removes both.
> <image.png>
>
> It seems the deep I go the more confused I am getting.
> Thanks
> Dave
More information about the Flac
mailing list