Playing non-MPG movies with Pygame

Pete Shinners pete at shinners.org
Tue Oct 16 17:41:59 CEST 2001


Bocco wrote:

> It's great that Pygame has built-in support for MPEG movies, but how
> would I write a program which could use other video formats? Do I
> actually need to load each individual frame, pixel by pixel, from the
> file into some massive multi-dimensional array, or is there a simpler
> way?


the answers you've already seen are correct. you'll need some C library 
that can decode whatever video stream you are looking at into raw 
uncompressed still frames. from there it will be very simple to provide 
a little "glue" that gets the image from the video decoding library into 
python.

i already know of a user who's been able to stream video from his webcam 
by using the python binding for SANE and transferring that data to a 
pygame Surface.

of course, if you already find a library that has native support for 
SMPEG, then you are in a really good position. that is why i stuck with 
SMPEG for video decoding. it is very integrated to SDL, it can render to 
offscreen surfaces, the audio is all properly tied in, and it can even 
use hardware accelerated overlay planes for the video. very nice.




More information about the Python-list mailing list