Just to say that I've had some success in displaying videos with cgkit.mediafile, thanks to https://github.com/hmeine/qimage2ndarray. I didn't succeed at installing/compiling it from source myself, but thanks to the work of Christoph Gohlke, there are Windows installers for Python2.6 through 3.3 available at http://www.lfd.uci.edu/~gohlke/pythonlibs/#qimage2ndarray. I had to back off from using PyQt4.10 to PyQt4.9, but that was a small price to pay for success! Instead of my failed attempts to load a QImage from a QByteArray (below), I can do the following now:

qimage = qimage2ndarray.array2qimage(ndArray)
## ndArray from class cgkit.mediafile.VideoData.numpyArray

Just to add that in my case I also had to flip and rotate the array 90 degrees for it to display correctly; otherwise it was sideways and reversed.

Video display solved; now if I can only figure out how to play the audio stream ...


Best regards,

Tim Grove



On 10/10/2013 21:32, Matthias Baas wrote:
On 09.10.13 23:30, Timothy W. Grove wrote:
Anyone with successful experience of using cgkit.mediafile with PyQt4 
and Python3 ?
[...]
     # convert ndArray into a QByteArray NOTE: is this correct ???
     byteArray = QByteArray(ndArray.data.tobytes())
     img.fromData(byteArray)
I have never tried passing an image from mediafile to PyQt, so I can't
give you a working example, but I believe the above fromData() call
expects an encoded image file, not the raw image data. So you could use
it if you had a jpg image, for example, but for passing raw data, you
would have to use one of the constructors that take a raw data pointer
(at least if you were using C++). I'm not sure if/how that is exposed in
Python though.

Cheers,

- Matthias -