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

Re: [pygame] playing an mpeg



your second example is a little closer to the mark, but first you have to get a display surface to show it on:

screen_size = (320, 240)
screen = pygame.display.set_mode (screen_size)
movie.set_display(screen)

make sure that when you use movie.set_display() that you are pointing to the that screen surface. your surface right now is just sitting off in memory by itself, and no one is looking at it!

rendering to a background surface (perhaps you want to do some additional compositing to the surface before you blit it to the screen) like this would be difficult because there aren't any callback methods that alert you when a frame has been completed. maybe someone has some more info about fine tuned control of an movie.




On Monday, September 1, 2003, at 07:42 PM, sashan wrote:

Hi all

I'm trying to play an mpeg file using pygame. I've tried something simple like this:

import pygame
from pygame.movie import *

pygame.init()
m = Movie('e:/movie.m1v')
m.play()

and something a bit more complicated:

import pygame
from pygame.movie import *
from pygame.surface import *

pygame.init()
m = Movie('e:/movie.m1v')
s = Surface(m.get_size())
m.set_display(s)
m.play()

but neither of them play the movie.
--
sashan
http://www.cs.auckland.ac.nz/~sgov008/