Search code examples
c#tagstaglibm4ataglib-sharp

How to get the rating tag of a .m4a file in C#


I work with TagLib# to get the ratings of my .mp3 files this part is working so far, but I have absolutely no idea how to get the rating of a m4a file.

This is how i get the rating of a .mp3 file, but it doesn't work for m4a:

TagLib.File file = TagLib.File.Create(Dateipfad);
Tag tag = file.GetTag(TagLib.TagTypes.Id3v2);
TagLib.Id3v2.PopularimeterFrame rating = TagLib.Id3v2.PopularimeterFrame.Get((TagLib.Id3v2.Tag)tag, "Windows Media Player 9 Series", true);
byte rate = rating.Rating;

How can I get the rating of an m4a file?


Solution

  • I'm not an expert, but mp3tag, winamp, and twonky use the %rate% atom.

    windows explorer writes to its own proprietary atom, but idk which one. (trying to figure that out is how I found this page)

    iTunes afaik only keeps ratings in its DB and doesn't write them to tags.

    mp3 uses id3, while m4a uses atoms.