Changing title property of mp3 file using java api

I have over 1000 mp3 files in one of my folders "D: \ songs \ Innisai Malai". Now I want to update all properties of the file header to its file name and all file names in Innisai Malai.

How to do this using java. Is there any API available to update the name for its file name for all files at a time without affecting the sound quality of the file.

+4
source share
2 answers

https://github.com/mpatric/mp3agic

this library is available on github. using it, you can open mp3 file

Mp3File mp3file = new Mp3File ("xxx.mp3");

extract your ID3v1 tag

ID3v1 id3v1Tag = mp3file.getId3v1Tag ();

and change with

SetTitle (string)

+6

ID3. , , : mp3agic javamusictag

mp3agic:

Mp3File mp3file = new Mp3File("SomeMp3File.mp3");
ID3v1 id3v1Tag;
if (mp3file.hasId3v1Tag()) {
  id3v1Tag =  mp3file.getId3v1Tag();
} else {
  // mp3 does not have an ID3v1 tag, let create one..
  id3v1Tag = new ID3v1Tag();
  mp3file.setId3v1Tag(id3v1Tag);
}
id3v1Tag.setTrack("5");
id3v1Tag.setArtist("An Artist");
id3v1Tag.setTitle("The Title");
id3v1Tag.setAlbum("The Album");
id3v1Tag.setYear("2001");
id3v1Tag.setGenre(12);
id3v1Tag.setComment("Some comment");
mp3file.save("MyMp3File.mp3");
+3

Source: https://habr.com/ru/post/1609274/


All Articles