Windows AVIFile problems

c d saunter christopher.saunter at durham.ac.uk
Fri Jan 25 13:04:45 CET 2008


Hi All,

I'm trying to access individual video frames of an AVI file from within 
Python 2.4 or 2.5 under Windows XP.

I have found this example code here for that does exactly what I want,
using the windows avifile.dll but I am unable to find the AVIFile.h 
header...

http://mail.python.org/pipermail/image-sig/2002-February/001748.html

An alternative is to call into avifile.dll dynamically using ctypes, 
however under both Python 2.4 and 2.5 the following error happens:

>>> from ctypes import *
>>> windll.AVIFile

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    windll.AVIFile
  File "C:\Python25\lib\ctypes\__init__.py", line 415, in __getattr__
    dll = self._dlltype(name)
  File "C:\Python25\lib\ctypes\__init__.py", line 340, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application

or

WinDLL('c:/windows/system/AVIFILE.DLL') # same for .../system32/AVI...
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    windll.AVIFile
  File "C:\Python25\lib\ctypes\__init__.py", line 415, in __getattr__
    dll = self._dlltype(name)
  File "C:\Python25\lib\ctypes\__init__.py", line 340, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application

This suggests that the dll is corrupt?  However if I download
and run the exe's from this example of a VB program calling
the DLL, they work:
http://www.shrinkwrapvb.com/avihelp/avihelp.htm

I'm open to suggestions about the specific problems above 
or other ways of getting at the frames.  I've tried pymedia
but it also has issues.

Regards
	Chris Saunter



More information about the Python-list mailing list