Friday, April 22, 2011

Snaky Playback - vidplay for Python

There exists a wonderfully simple and easy game programming environment for Python called Pygame: http://www.pygame.org/
I haven't created any games for the public yet (sorry, my scant readers) but I am using Pygame for various projects (they are a bit hush-hush for now).
Being used to the idea that everything in Python is easy, I thought that video playback would be a matter of play(videoname), and decided to build videos into my project. But oh no, life cannot be so sweetly easy. There seems  to be a dearth of video playback tools for python, all of them complex and/or badly maintained. The largest and most established option, pymedia, is much too complex for me to enjoy easily.There is a video playback option for Pygame in linux: http://www.pygame.org/docs/ref/movie.html , but this does not work on Windows, and this will not do at all!

With Windows video playback in mind I have set out to wrap a simple ffmpeg based video decoder in a dll library (and a .so library in Linux), which will then send the decoded data to a playback script I will write in python.I call the library vidplay so that I can ultimately do this in python:
import vidplay

vidplay.play("videoname.mpg")

And that's it!

Hopefully I can extend this to a legitimate ffmpeg-based python library in the future, but for this initial stage functionality will be king, though it may make usage a bit scrambled.
壊れた卵のようにです

No comments:

Post a Comment