Taglib sharp not editing rating

2.2k views Asked by At

I have encountered a very strange problem while using Taglib sharp. I am changes the rating of video file by using code shown below.

        TagLib.File file = TagLib.File.Create(FULLFILEPATH);
        TagLib.Tag Tag = file.GetTag(TagTypes.Id3v2);
        TagLib.Id3v2.PopularimeterFrame frame = TagLib.Id3v2.PopularimeterFrame.Get((TagLib.Id3v2.Tag)Tag, "WindowsUser", true);
        frame.Rating = 255;
        file.Save();

After saving file when i open the detail tab of video file from properties, rating seems not to be change. But when i again read that file programmatically in c# and check its rating value, it is 255. Why this happening and why rating value is not updating ?

1

There are 1 answers

0
Brian Nickel On BEST ANSWER

Looking at the answer to Check music file rating with VB.NET + WinForms, the likely cause is that your tags may be getting saved as iD3v2.4 and Windows only supports iD3v2.3.

You can force TagLib# to save your tags as iD3v2.3 with the following code:

TagLib.Id3v2.Tag.DefaultVersion = 3;
TagLib.Id3v2.Tag.ForceDefaultVersion = true;