Only the first ID3v2 frame can be accessed

Gabriel Burca gburca-taglib at
Mon Jan 7 07:10:58 CET 2008

Scott Wheeler wrote:
> Gabriel Burca wrote:
>> I tried using taglib version 1.4 to read all the frames in an MP3 ID3v2 tag, but
>> was only able to obtain the first frame. Searching for some sample code on-line
>> I found tagdump2.cpp which also seems to only display the first frame. Is this a
>> known issue, or is there an error in my (and the tagdump2 author's) usage of the
>> library?
>> The tagdump2 file can be found at:
>> My code does essentially the same thing:
>> TagLib::MPEG::File mp(filePath);
>> TagLib::ID3v2::FrameList allFrames = mp.ID3v2Tag()->frameList();
>> cout << "Frames found: " << allFrames.size()); // Always reports just 1 frame
>> std::list<TagLib::ID3v2::Frame *>::iterator iter = allFrames.begin();
>> while (iter != allFrames.end()) {
>>     // Show frame contents
>>     iter++;
>> }
>> If I remove the first frame from the mp3 file, the code will show me the next
>> one, but always just one frame. The frameList() call seems to only return a
>> 1-element list.
> The example works fine here -- on the file I just tried it on it reports
> 7 frames.  My guess would be that either:
> - You're testing this on a file that is corrupt in some way
> - You're removing things from the list while iterating over it, which
> makes the iterator invalid

I'm not modifying the list while iterating over it so the iterator should be
valid. Either way, the call to allFrames.size() is consistent in reporting just
one frame.

Based on your suggestion, I have tried a few more mp3's. For some of them taglib
show multiple frames while for others only the first frame shows up. Perhaps the
first batch of files I tried is "corrupt", but the id3v2 binary on my system
(which reports that it's using id3lib-3.8.3) shows multiple frames for all of
them. I can send you one of the files that taglib has problems with if you want
to take a look at it.

Gabriel Burca - gburca dash taglib at ebixio dot com

More information about the taglib-devel mailing list