Python Video processing.
Hi all, I have a specific task I want to automate - rotating a video file through 90 degrees. I've used the PIL library quite a bit to perform batch processing on images, and would like to do similar on video. Can anyone see a problem with the following: 1) Use pymedia to convert the video into a sequence of stills (e.g. http://pymedia.org/tut/src/dump_video.py.html) 2) Use PIL to process each still 3) Use pymedia to re-pack the still into video format. In particular, does anyone know whether the data obtained from decoding the video frame as in the following snippet from http://pymedia.org/tut/src/dump_video.py.html: dd= d.convert( fmt ) img= pygame.image.fromstring( dd.data, dd.size, RGB ) can be directly loaded into a PIL Image object (and back again?)? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Video processing.
Ant [EMAIL PROTECTED] wrote: In particular, does anyone know whether the data obtained from decoding the video frame as in the following snippet from http://pymedia.org/tut/src/dump_video.py.html: dd= d.convert( fmt ) img= pygame.image.fromstring( dd.data, dd.size, RGB ) can be directly loaded into a PIL Image object (and back again?)? iirc, the pygame fromstring/tostring methods are designed to be data-compatible with PIL's corresponding methods, so you should be able to do im = Image.fromstring(RGB, dd.size, dd.data) instead of doing that pygame.image call (not that the argument order is different). for details, see the pygame tostring/fromstring docs, and the corresponding PIL methods: http://www.pygame.org/docs/ref/image.html http://www.pythonware.com/library/pil/handbook/image.htm hope this helps! /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Video processing.
im = Image.fromstring(RGB, dd.size, dd.data) instead of doing that pygame.image call (not that the argument order is different). for details, see the pygame tostring/fromstring docs, and the corresponding PIL methods: That's starting to look promising, yes - thanks! I'll give it a shot this evening and see what happens... -- http://mail.python.org/mailman/listinfo/python-list