Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Audio and video metadata extraction

2,039 views
Skip to first unread message

Samir Sheldenkar

unread,
Jul 17, 2003, 4:09:37 AM7/17/03
to
Does anyone know of a way of extracting any metadata stored in audio and
video files (e.g. length, artist, ...) using Java? Or an external API that
will do this?

I've found an ID3 tag extraction library
(http://www.rabbitfarm.com/id3.html) for MP3 files, but I need libraries for
other filetypes.

Thanks,
Samir Sheldenkar


Jon A. Cruz

unread,
Jul 17, 2003, 11:34:02 AM7/17/03
to
Samir Sheldenkar wrote:
> Does anyone know of a way of extracting any metadata stored in audio and
> video files (e.g. length, artist, ...) using Java? Or an external API that
> will do this?

JMF


http://java.sun.com/products/java-media/jmf/

Samir Sheldenkar

unread,
Jul 21, 2003, 5:14:36 AM7/21/03
to

"Jon A. Cruz" <j...@joncruz.org> wrote in message
news:3F16C1EA...@joncruz.org...

Thanks - but looking at the API and trying out small programs, I can't work
out how to actually use this API to extract the information I'm looking for.
Does anyone have experience of using JMF and could help me work out how to
just use it to get file information?

Samir


Jon A. Cruz

unread,
Jul 21, 2003, 11:29:37 PM7/21/03
to

Yes, me.

:-)

Ask a more specific question, you'll get a more specific answer.

Jon A. Cruz

unread,
Jul 21, 2003, 11:50:11 PM7/21/03
to
Jon A. Cruz wrote:

> Samir Sheldenkar wrote:
>
>> Thanks - but looking at the API and trying out small programs, I can't
>> work
>> out how to actually use this API to extract the information I'm
>> looking for.
>> Does anyone have experience of using JMF and could help me work out
>> how to
>> just use it to get file information?
>
>
> Yes, me.
>
> :-)
>
> Ask a more specific question, you'll get a more specific answer.
>

http://java.sun.com/products/java-media/jmf/index.html

Oooh. "Programmer's Guide"
http://java.sun.com/products/java-media/jmf/2.1.1/guide/


"Data Model"
http://java.sun.com/products/java-media/jmf/2.1.1/guide/JMFArchitecture.html#112436


The length you can get once the data item is in a player.

The next step is to follow those to get a DataSource and then see what
you can get from it. Also checked once a Player has a source ready.

Quicktime has it's own way of doing meta data. Windows files also.
Playing with things in Eclipse's debugger would probably be most helpful.


Oh, and for MP3, you might also check out
http://javamusictag.sourceforge.net/

Samir Sheldenkar

unread,
Jul 22, 2003, 5:26:35 AM7/22/03
to
"Jon A. Cruz" <j...@joncruz.org> wrote in message
news:3F1CB473...@joncruz.org...

>
> The length you can get once the data item is in a player.
>
> The next step is to follow those to get a DataSource and then see what
> you can get from it. Also checked once a Player has a source ready.
>
> Quicktime has it's own way of doing meta data. Windows files also.
> Playing with things in Eclipse's debugger would probably be most helpful.
>
>
> Oh, and for MP3, you might also check out
> http://javamusictag.sourceforge.net/

OK, thanks. I'd looked at the programmer's guide and API documentation, but
am finding it difficult to extract just the information that is relevant for
my needs - most of the documentation is obviously geared towards uses where
the file needs to be played or processed in some fashion, and so it just
serves to confuse me.

Here's a small test program:
----------------------
import java.io.*;
import java.net.*;
import javax.media.*;
import javax.media.protocol.*;
import javax.media.bean.playerbean.*;

class Test {

public static void main(String[] args) throws Exception {

URL url = new File(args[0]).toURL();

MediaPlayer m = new MediaPlayer();
m.setMediaLocator(new MediaLocator(url));
URLDataSource ds = new URLDataSource(url);

System.out.println("Using player, duration is:
"+m.getDuration().getSeconds()+" seconds");
System.out.println("Using datasource, duration is:
"+ds.getDuration().getSeconds()+" seconds");

}

}

-------------------------------------

Both the player and datasource give a DURATION_UNKNOWN value.

I don't know if I'm using the player correctly - do realize() and/or
prefetch() need to be called? I've tried doing that and it seems to make no
difference. Also, the API documentation for URLDataSource.getDuration() says
"Returns Duration.DURATION_UNKNOWN. The duration is not available from an
InputStream." Why??

Once you have a DataSource, how would you extract metadata from it? There
don't seem to be any obvious methods or classes to do this...

Thanks for all your help,
Samir


Jon A. Cruz

unread,
Jul 22, 2003, 11:11:53 PM7/22/03
to
Samir Sheldenkar wrote:
> Once you have a DataSource, how would you extract metadata from it? There
> don't seem to be any obvious methods or classes to do this...
>

It's been a while since I worked in it, so I'd have to take a little
time to look it up.

However, breakpointing in Eclipse will instantly let you see what you
have, and even the true classes, IIRC.

Miguel De Anda

unread,
Jul 23, 2003, 5:53:03 PM7/23/03
to

"Jon A. Cruz" <j...@joncruz.org> wrote in message
news:3F16C1EA...@joncruz.org...

I just tried installing jmf and I get a bunch of problems. I've extracted
the files, and set the 2 env. variables. I try running the diagnostics
applet and only netscape 4 sorta works. (I hear sound but no video with the
sample pages). IE6 and Netscape 7 give me a grey box with a red x on the top
left. I just realized that netscape 7 doesn't want to run any java applets
at all and instead has made me reinstall the jre twice. Can somebody please
help me.

I'm also interested in reading metadata from audio/video files. If jmf does
not work for this task, I'd be willing to write a library for it (if I can
get information on how to do it). I think rtsp servers can be queried for
such information. Not sure about windows media stuff though. Not sure about
http/file real/quicktime stuff either.


0 new messages