Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
greetings,
i want to make a program for editing the id3tag for a mp3 file.
i would like to know , about what all topics do i need to study to implement such a program. i know how to program in c and c++ but to the extent they teach at college level(not very very much).





thank you.

[edit reason="Moved from comment"]
C++
I FOUND THIS CODE ON THE NET..... DOESNT RUN ON MY PC... COULD YOU TELL ABOUT THE LIBRARIES USED....
#include<iostream>
#include<stdio.h>

/*taglib specific includes*/
#include<tbytevector.h>//ByteVector
#include<mpegfile.h>//mp3 file
#include<id3v2tag.h>//tag
#include<id3v2frame.h>//frame
#include <attachedpictureframe.h>//attachedPictureFrame

using namespace std ;
using namespace TagLib::ID3v2 ;

int main(int argc, char * argv[])
{
    if(argc !=2)
    {
        cout<<"usage: drag an mp3 file on to the program and it will extract the attached image"<<endl<<endl;
        system("pause");//on linux you can replace this with cin.get()
        exit(1);
    }

    TagLib::MPEG::File mp3File(argv[1]);
    Tag * mp3Tag;
    FrameList listOfMp3Frames;
    AttachedPictureFrame * pictureFrame;

    mp3Tag= mp3File.ID3v2Tag();
    if(mp3Tag)
    {
        listOfMp3Frames = mp3Tag->frameListMap()["APIC"];//look for picture frames only
        if(!listOfMp3Frames.isEmpty())
        {
            FrameList::ConstIterator it= listOfMp3Frames.begin();
            for(; it != listOfMp3Frames.end() ; it++)
            {
                pictureFrame = static_cast<attachedpictureframe> (*it);//cast Frame * to AttachedPictureFrame*

                //Warning. format of picture assumed to be jpg. This may be false, for example it may be png.
                FILE * fout;
                fopen_s(&fout, "outputFile.jpg", "wb");
                cout<<"processing the file "<< argv[1] <<endl<<endl;
                fwrite(pictureFrame->picture().data(), pictureFrame->picture().size(), 1, fout);
                fclose(fout);
                cout<<" The picture has been written to \t outputFile.jpg  \nRemember that the file type .jpg is just assumed for simplicity"<<endl<<endl;
            }
        }
        else cerr<<"there seem to be no picture frames (APIC) frames in this file"<<endl<<endl;
    }
    else cerr<<"the file "<<argv[1]<<"does not appear to have any mp3 tags"<<endl<<endl;

    system("pause");//on linux you can replace this with cin.get()
    return 0;
}


[edit]
Posted
Updated 5-Jan-13 2:25am
v2

1 solution

Assuming your C++ skills are up to it then you just need to study MP3 file formats[^] to see what information is held in them.
 
Share this answer
 
Comments
[no name] 5-Jan-13 7:57am    
Comment moved to Original question.
Richard MacCutchan 5-Jan-13 8:28am    
Sorry I have no idea what libraries it may use. If you "found some code on the internet" do not be surprised if it does not work. Go back where you found it and ask the person who posted it.
Abhishek Shirdhone 20-May-19 2:08am    
How to get type of album art image. I'm facing problem with other than jpg. I want bmp and png format for my work. please any solution.
Richard MacCutchan 20-May-19 3:25am    
Why have you posted that in a 6 year old answer?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900