I have more than 1000 mp3 files in one of my folder "D:\songs\Innisai Malai". Now, I want to update all file's title property to its file Name and all file's album name to Innisai Malai.
How to do it using java. Is there any API available to update the title to its file name for all the files at a time without impacting the file's sound quality.
It turned out that Java 7 has support for mp3 files: String bip = "example. mp3"; Media hit = new Media(bip); MediaPlayer mediaPlayer = new MediaPlayer(hit); mediaPlayer. play();
Metadata, also referred to as ID3 tag for mp3 files, is the identifying information associated with your song, such as the. composers. performers. song title. title of the album on which it was released.
https://github.com/mpatric/mp3agic
this library is available on GitHub. using it you can open a mp3 file
Mp3File mp3file = new Mp3File("xxx.mp3");
fetch its ID3v1 tag
ID3v1 id3v1Tag = mp3file.getId3v1Tag();
and modify using
setTitle(String)
You need to edit ID3 tag. There are several libraries, which can do it, for example: mp3agic or javamusictag
Here is an official example for mp3agic library:
Mp3File mp3file = new Mp3File("SomeMp3File.mp3");
ID3v1 id3v1Tag;
if (mp3file.hasId3v1Tag()) {
id3v1Tag = mp3file.getId3v1Tag();
} else {
// mp3 does not have an ID3v1 tag, let's 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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With