Saturday, 12 July 2014

How to extract information like artist, album, comments, album art from mp3 file?

Follow these steps

  1. Download C# ID3 library from internet or use "http://sourceforge.net/projects/csid3lib/files/csid3lib/"  (Click Download csid3lib-v0.6-src.zip (3.3 MB) ) .
  2. Once you have downloaded the file,extract it and open id3lib.sln and and rebuild the solution.
  3. Now click start button to start debugging.
  4. After that start a new project(C#) and add a window form.
  5. Right click your project solution and click "add reference".
  6. Now click Browse button .
  7. Goto "C:\csid3lib-v0.6-src \id3lib\Mp3Lib\bin\Release" (Here i have extract the zip file in c:\ drive) and select these three files: "Id3Lib.dll", "Mp3Lib.dll", "ICSharpCode.SharpZipLib.dll" 
  8. Now you have added the dll files and can use it.
  9. Now to extract the information from mp3 file use following code:
 Mp3Lib.Mp3File file = new Mp3Lib.Mp3File(@"f:\AASHIQ.mp3");   //give the path of mp3 file.

tbAlbum.Text=file.TagHandler.Album;  //get the album of mp3 file

other properties of file.TagHandler are:
 file.TagHandler.Artist;
            file.TagHandler.Comment;
            file.TagHandler.Composer;
            file.TagHandler.Disc;
            file.TagHandler.Genre;
            file.TagHandler.Lyrics;
            file.TagHandler.Picture;
            file.TagHandler.Title;
            file.TagHandler.Track;
            file.TagHandler.Year;

Thanks...
Please comment...

1 comment: