c++mp3id3lib

id3lib extract tags


I try to use ID3lib from C++. I tested near 50 mp3 files and most often I get answer that files haven't any tags. But actually, they are there ( I check it using another software and it shows them properly)

Actually, I've done nothing, I'd only linked library and copied example from offficial documentation

 void next_try()
 {
  ID3_Tag tag;
  tag.Link("file.mp3");
  cout<<"success\n";
  cout<<tag.GetFileSize()<<"\n";

   ID3_Frame *frame;
    if ( frame = tag.Find ( ID3FID_TITLE ) )
      {
       char title[ 1024 ];
       frame->Field ( ID3FN_TEXT ).Get ( title, 1024 );
       cout << "Title: " << title << endl;
      }
    else
     cout<<"not found\n";
 }

And a file that does have tags http://zalil.ru/33733757

But I get answer that it hasn't tag. But it has!!! And it's not a single occurrence. I wonder whether this library really works.

Perhaps someone had experience with this library. Moreover I am confused, because there are links on the official page to the working projects, so it has been proven that library can work properly.
Thanks in advance for any tips.


Solution

  • id3lib is no longer maintained and quite outdated as it does have no support for ID3v2.4.

    You can easily see that with hexdump -C -n4 your.mp3:

    00000000 49 44 33 03 |ID3.| 00000004

    If the mp3 file starts with ID3 and the 4th byte is a 03, it will work with id3lib. If there's a 04 it's using ID3v2.4.