aspose file tools*
The moose likes Other Java Products and Servers and the fly likes retrieving the information stored in the properties of an audio/video file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "retrieving the information stored in the properties of an audio/video file" Watch "retrieving the information stored in the properties of an audio/video file" New topic
Author

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

Maryam Nouhnejad
Ranch Hand

Joined: Oct 04, 2006
Posts: 39
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

Joined: Jul 08, 2004
Posts: 531

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.


Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61661
    
  67

Not a JDBC question so it's been moved to the Other Java Products forum.
[ October 11, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: retrieving the information stored in the properties of an audio/video file