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

Re: [pygame] Displaying objects over movies



On Fri, 4 Mar 2005, Nikolai Hlubek wrote:

> Hi everyone

hi

> I use pygame.movie to display a movie in the
> background. Then I try to have some objects
> displayed in the foreground. The problem is
> that they flicker horribly. Is this a general
> limitation of pygame?

no.

there are some ways that work.

with plain old pygame.movie (which wraps smpeg),
you can use render_frame to control the drawing
and get no flicker (.play() uses threading and can cause that).
i've used this in production for over a year, works ok,
but is mpeg1 only and pretty cpu intensive.

with the new (1.6.2 or 1.7) there is the movieext module,
which uses 'the mplayer libs' (can play .avi, quicktime .mov etc)
that uses the also new pygame.Overlay, which has the feature
that *when it is a hardware overlay surface* it draws *underneath*
normal pygame gfx, and does not dirty them, so you get the video in the 
background for free. i haven't tested what happens with alpha. 
unfortunately the pygame.movieext is not too complete (see earlier posts 
with little patches that help with some things)

yet another choice is to use mplayer bmovl2,
which enables putting bitmaps to mplayer's memory
and then moving them around the screen, alpha works nice etc.
the limitation is that there is no way to get the keypresses or anything 
from mplayer back to e.g. pygame, but for the system i'm using it in it 
does not matter (it's remotely controlled).
you can use bmovl2 from python with the mevas canvas lib
that is used in freevo(2), which normally uses pygame.

> Nikolai

~Toni