On Dienstag 29 Januar 2008, Brian Blais wrote:
Is there a way to read frames of a movie in python? Ideally, something as simple as:
for frame in movie('mymovie.mov'): pass
where frame is either a 2-D list, or a numpy array? The movie format can be anything, because I can probably convert things, but most convenient would be avi, mov, and flv (for youtube videos).
I'd look for Gstreamer python bindings. Or run mplayer/mencoder with a "raw" format (e.g. yuv4mpeg or -ovc raw -vf format=bgr24/rgb15/...) using a pipe and processing the frames one by one. OK, that's no iterator-based interface yet, but one could probably hack that together in an hour or so. Ciao, / / .o. /--/ ..o / / ANS ooo