[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Pygame non-MPEG1 video options?



Hi Everyone,

I have a Python app that's pretty much ready to go. Problem is that we need to be able to play videos. To be honest I never really looked too deep into Pygame's video support. I knew from the docs that it had to be MPEG-1 and that if you wanted audio then it had to have exclusive control of Pygame.media, so I kind of thought, "Ok, that's fine, I'll deal with all that later."

So now it's "later" and I'm dealing with it. :)

Problem is that we cannot get videos converted to MPEG-1 in a way that works reliably. We've gone through all the posts on this list and read a lot. Sometimes the videos play, sometimes not, sometimes we get SDL errors, sometimes we get garbage on the screen.. It's really kind of a mess.

So I've started looking into options for non-MPEG1 videos and I wonder if anyone has successfully done anything?

I found a blog post where a guy wrote a simple app that uses Pyglet to play the video and then for each frame it converts the Pyglet video frame to a Pyglet texture (kind of like Pyglet's version of a Surface), converts the pixels to a ctype, converts the ctype to the format Pygame can use, converts it to an image, then blits it to the Pygame window surface. That technically works but it's far too slow.. for hi-def videos we're only getting about 10fps.

So I wonder if there are any other alternatives? Like can we install SDL2 and use PySDL2 to play the video and somehow convert that to a Pygame surface? (I have no idea if surfaces between SDL1.2 and SDL2 are compatible, or if so if it would be possible to get them into Pygame.)

Or are there any other crazy ideas?

To be honest if we can't figure this out then I think we're going to have to go with something other than Pygame, which would be a lot of work, but I don't know of any other alternatives? Unfortunately I don't know C or C++ so I'm afraid I'm not much help in terms of contributing to Pygame.

Has anyone successfully taken a Python project based on Pygame and converted it to PySDL2? From what I've read it seems like there are many similarities since they're both SDL, but I don't know how much "other" work Pygame is doing, and whether if I recreated any of that in Python it will be fast enough?

Anyway, sorry I'm a bit all over the place. I wonder if anyone has any thoughts to share?

Thanks,
Brian

--
Brian Madden
Mission Pinball (blog | twitterMPF software framework | sample games)