This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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() );
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.