views:

94

answers:

1

i need a simple python lib that check the uploaded files to my webserver are flash media (FLV), by reading the flv header (metadata) and not the mimetype extension.

+4  A: 

Kaa is simple to use and quite powerful as well.

Right away:

>>> import kaa.metadata
>>> info = kaa.metadata.parse('tlib_allie_jordan-sd169.wmv')
>>> print info
|       type: asf format
|      media: MEDIA_AV
|       mime: video/x-ms-asf
|     length: 1871.166
+-- Video Track #1
|    |      media: MEDIA_VIDEO
|    |      codec: Windows Media Video V8
|    |      width: 768
|    |     height: 432
|    |     fourcc: WMV2
|    |         id: 1
+-- Audio Track #1
|    |      media: MEDIA_AUDIO
|    |   channels: 2
|    | samplerate: 48000
|    |      codec: Windows Media Audio V7 / V8 / V9
|    | samplebits: 16
|    |    bitrate: 64000
|    |     fourcc: 0x161
|    |         id: 2

See what Kaa can support. Support includes FLV.

progo
+1 Precise and to the point.
Noufal Ibrahim
thank you progo, i found special and more lightweight flv lib on pypi<a href="http://pypi.python.org/pypi/flvlib/0.1.11">flvlib</a> it was designed to answer my question
Dantario
Yes, you should use a more specialized lib for FLV checking only. Kaa is quick when loaded but it adds a little to my start times.
progo