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

[pygame] Rendering a movie from a hidden surface to the main display



I want to overlay images and text over videos. I'm currently using the movie object.
I've seen in the documentation that this can be accomplished creating a hidden surface which pays the movie, and rendering its contents as images in the display surface.

I'm getting segmentation faults when i try to play the movie.

Traceback (most recent call last):
 File "pimplayer.py", line 73, in ?
   if __name__ == '__main__': main()
 File "pimplayer.py", line 60, in main
   pimmovie.play()
 File "/home/alex/documents/programming/pimplayer/pimobjects/PimMovie.py", line 84, in play
   self.screen.blit(self.surface,(0,0))
pygame.error: display Surface quit
Fatal Python error: (pygame parachute) Segmentation Fault

This is the code for the method play():

def play (self):
self.surface=pygame.Surface(self.size)
self.movie.set_display(self.surface)
self.movie.play(self.repeat)
while self.movie.get_busy(): self.screen.blit(self.surface,(0,0)) pygame.display.update() time.sleep(0.1)



I've had no problem playing the movie on the display surface. But i can't seem to be able to render the movie from another surface.

BTW is there any way to obtain the value from the movie's frame rate? i think i should set the time.sleep to a value according to the movie's frame rate.


Thanks for your help. alex.