tags:

views:

23

answers:

1

Hi,

I am writing a python module which checks several media and document formats whether the files correct or somehow corrupted/wrong formatted. It returns an error message or - if the file is correct - some information about the file (e.g. framerate, channels, ...)

Now I am looking for a python module which I can use to check ogg-Files. There is no need to play the file, it should simply return an Exception if the file seems not to be a correct ogg-File.

It should run on OSX and Linux. At the moment I am tending to python-ogg. But I think it will be some work to get it running on OSX 10.6 and perhaps there is an easier solution when there is no need to play the files.

Best regards!

+1  A: 

Have you looked at Hachoir? It 'extracts metadata from multimedia files', including Ogg Vorbis.

The different file format parsers give differing levels of detail, and I haven't tried the Vorbis one, but it might be what you are looking for. Here's an example of metatdata extraction from an AVI file:

$ hachoir-metadata pacte_des_gnous.avi
Common:
- Duration: 4 min 25 sec
- Comment: Has audio/video index (248.9 KB)
- MIME type: video/x-msvideo
- Endian: Little endian
Video stream:
- Image width: 600
- Image height: 480
- Bits/pixel: 24
- Compression: DivX v4 (fourcc:"divx")
- Frame rate: 30.0
Audio stream:
- Channel: stereo
- Sample rate: 22.1 KHz
- Compression: MPEG Layer 3
Scott Griffiths
Hi, I checked it out and it looks quite good. The only problem for now is that it analyses the media file independently from the file suffix. So when I rename an avi to ogg, it returns the correct metadata for the avi. But I think this should be solvable easily.
o.elias
That sounds more like a feature than a problem! If it analyses the file and thinks that it isn't Vorbis then that's a pretty good indication that there's a problem with it. (As a side note, congratulations on getting enough rep to upvote answers (hint, hint :))
Scott Griffiths
Thanks for the hint ;)
o.elias