Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

retrieving the information stored in the properties of an audio/video file

 
Maryam Nouhnejad
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I'm writing a databse program and I need to display the information stored in the properties of an audio/video file in a table. (for example name of the artist, genre, date of being released, name of the album and so on...)
I searched in JDK 5.0 documentation and I found the method properties() in class AudioFileFormat. It can return a map including all the information; but my problem is that Java only supports some specific extensions like AIFF, wav and ... BUT I also have some audio files with mp3 formats and need to display those information too...
I know that because JMF(Java Media Framework) supports these extensions, it can play these songs. But my problem is that how I can use it ( or any software that supports those extensions) to retrieve those data.
Or do you have a better idea? Could you tell me please?

-----------> This is a piece of my code :

In the main method :
File aFile = new File("C://RitesOfPassage.mp3");
I pass this object (aFile) to the constructor of my class, and then it is passed like this :
//Some of these classes and method are only known by 'JMF'
MediaLocator mediaLocator = new MediaLocator(aFile.toURL());
Player player = Manager.createRealizedPlayer(mediaLocator);
//Here it gives error ... If I simply pass 'aFile' to the
//getAudioInputStream there would be no problem but when
//I do this it gives me UnsupportedAudioFileException and
//says it could not get audio input stream from input URL.
AudioInputStream in = AudioSystem.getAudioInputStream(mediaLocator.getURL());
AudioFormat format = in.getFormat();
System.out.println( format.properties() );

What should I do now? any idea ...?

Thanks in advance,
Maryam
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I once used javamusictag project http://javamusictag.sourceforge.net/ for working with mp3 ID3 tags.

I think thare are some other libraries that you can use to extract metadata from other multimedia format if there is any meta data stored in them.
for example qtJava could be used to handle all quicktme format and so on.

about JMF , i remember that we could play and also extract metadata from a multimedia file using the Player Object IIRC , but i really do not remember whether it return your required information or not.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a JDBC question so it's been moved to the Other Java Products forum.
[ October 11, 2006: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic