• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

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

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67537
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic