To read ID3 tags from MP3 files using C++ and Qt you can take many routes and here are some of them:
- You can read the Wikipedia article on ID3 Tags (which is pretty much detailed) and write your own ID3 Tag reader. Simple but takes too long.
- Or you can use some kind of 3rd party library, like id3lib which encapsulates all the complexities. This is even more simple and doesn’t take that much time 🙂
Here is a simple guide on how to use id3lib with Qt:
- Download id3lib binaries and source codes from here.
- Copy include folder and binaries to your project folder.
- Add the include path and libs to your PRO file.
- INCLUDEPATH += id3lib/include
- Add the following line to the topmost point of your sources, or in other words, before including id3 sources.
- #define ID3LIB_LINKOPTION 3
- Include id3lib main header in your source.
- #include “id3.h”
- Before you try to run the project make sure that id3lib DLL file is copied to the same folder with your project’s executable.
You can download the example Qt project from here: