robins has asked for the wisdom of the Perl Monks concerning the following question:
Okay, I've been working with a web-application that allows users to upload files. I'm using CGI.pm to do the actual uploading. The uploading part is going along nicely, but I need to extract some metadata from the uploaded files to be able to categorize them.
I use stat() and File::MimeInfo::Magic::mimetype to figure out the datatype of the file. But this module has problem figuring out that OpenDocument is in fact ODT and not application/zip. I guess I need to use the passed filename's extension to do a lookup in some table (if you know which one, please tell me!) and assume a specific mimetype if there is in fact an extension passed into the function (the filename is from CGI.pm uploadInfo() ).
For detecting image metadata I use Image::Size, but this ONLY detects dimensions, not other metadata like author and title.
In the sound department I use Audio::Wav and MP3::Info to detect information like duration and title. This works more or less as it should.
It's in the video department I have most problems. MS WMA is detected as video/x-ms-asf (using Audio::WMA), and is thus not filed as audio, but as video (even though it doesn't contain any video frames). The other problem is that I'm unable to extract video dimensions (width+height) out of WMV/ASF files. And because the openquicktime Perl module isn't adhering to my debug settings, I had to fork and use qtinfo (external command) to grab QuickTime metadata (which isn't very cross-platform). And for basic MPEG1/2/4 streams I don't know what to do. None of the packages I found on CPAN seems to be stable/mature enough to feed me sufficient information.
As you can see, this method brings with it a lot of dependencies, and makes it harder to install the application. I was hoping there was an easier way to detect all of the metadata. Maybe there is a metadata extraction project that has integration with Perl? I was thinking about FFmpeg's libavformat, but it's hard to find any documentation on how to use this library in Perl wrt. metadata extraction.
Solutions?
PS: Forking wouldn't be all that bad if there was one single application that could actually manage to detect everything I needed, but doing it for all the different checks would be overkill. Suggestions welcome in that department aswell.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multimedia metadata extraction - how to have it all?
by jhourcle (Prior) on Jun 14, 2006 at 11:11 UTC | |
|
Re: Multimedia metadata extraction - how to have it all?
by wazoox (Prior) on Jun 14, 2006 at 14:12 UTC | |
|
Re: Multimedia metadata extraction - how to have it all?
by Moron (Curate) on Jun 14, 2006 at 12:15 UTC | |
|
Re: Multimedia metadata extraction - how to have it all?
by wazoox (Prior) on Jun 14, 2006 at 19:51 UTC | |
by robins (Acolyte) on Jun 23, 2007 at 06:20 UTC |