views:

60

answers:

2

Hi,

I have a couple of video container files which contain audio and video in various codecs. Now I'd like to inspect the container from a Python script to know which codec is used for audio+video. This is on a linux box so I have all the tools available if necessary.

I thought that maybe gstreamer could help me here but I was unable to find an API which could help me here.

Any ideas? I'm also open for any suggestion, doesn't need to be gstreamer as long as it is free software :-) fs

+2  A: 

Try downloading the ffmpeg source and look at the source for their command line programs. I've hacked up similar utilities in the past. I'm not posting my solution because ffmpeg likes to change their API, so my old code is unlikely to compile with the current version. You'll want to do enough work to create codec context, which you can inspect to get what you need.

Some other alternatives:


EDIT:

http://code.google.com/p/pyffmpeg/ might have what you want (I haven't used it myself).

Mr Fooz
so this means there is no library which can return that information?
Felix Schwarz
+1  A: 

You can use decodebin2 in Gstreamer. Take a look at TAE for code examples.

Andreas Tunek
thanks for the pointer, looks like this does pretty much what I need...
Felix Schwarz