[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] problem - movie in pygame
hi,
using libavcodec (ffmpeg) is definitely planned/wanted for pygame...
cu,
On Thu, Sep 4, 2008 at 11:18 AM, Forrest Voight <voights@xxxxxxxxx> wrote:
> I think PyGame could use a new movie module... a binding of libavcodec probably.
>
> For one of my games, I gave up and decided to write my own video codec
> in Cython instead of messing with PyMedia.
>
> On Wed, Sep 3, 2008 at 8:16 PM, bhaaluu <bhaaluu@xxxxxxxxx> wrote:
>> I run a Debian GNU/Linux system, Python 2.4.4 and PyGame 1.7.
>>
>> I use this script to play movies. Maybe you can modify it for your game?
>>
>> #!/usr/bin/python
>> """Usage: python playMovie.py movie.mpg
>> 'q' = Quit
>> """
>> import pygame
>> from pygame.locals import *
>>
>> def main(filepath):
>> pygame.init()
>> pygame.mixer.quit()
>> movie = pygame.movie.Movie(filepath)
>> screen = pygame.display.set_mode(movie.get_size())
>> movie.set_display(screen)
>>
>> pygame.event.set_allowed((QUIT, KEYDOWN))
>> movie.play()
>> while movie.get_busy():
>> evt = pygame.event.wait()
>> if evt.type == QUIT:
>> break
>> if evt.type == KEYDOWN and evt.unicode == u'q':
>> break
>> if movie.get_busy():
>> movie.stop()
>>
>> if __name__ == '__main__':
>> import sys
>> main(sys.argv[1])
>>
>> Hopefully helpful,
>> --
>> b h a a l u u at g m a i l dot c o m
>> Kid on Bus: What are you gonna do today, Napoleon?
>> Napoleon Dynamite: Whatever I feel like I wanna do. Gosh!
>>
>> On Wed, Sep 3, 2008 at 11:40 AM, pesvieira <pesvieira@xxxxxxxxx> wrote:
>>> Hi.
>>>
>>> I'm wanting to play a movie when I start my game, but I'm having a
>>> problem at playing a video in pygame. I already used pygame.movie and
>>> pymedia to do that, but they didn't work.
>>>
>>> The pygame.movie only supports MPEG1 encode, and the video is being
>>> displayed with low quality.
>>>
>>> Using pymedia the problem is when I use the player.py module. The
>>> video and audio aren't in sync. I tried to limit the FPS for that the
>>> images don't be displayed too quickly, but I didn't find how to do
>>> this in pymedia.
>>>
>>> Somebody knows how to solve this problem? Or, Is there any another
>>> libary to play a movie in python?
>>>
>>>
>>> Thanks.
>>>
>>
>