pygame documentation |
||
Pygame Home ||
Help Contents ||
Reference Index ||
Camera || Cdrom || Color || Cursors || Display || Draw || Event || Examples || Font || Gfxdraw || Image || Joystick || Key || Locals || Mask || Midi || Mixer || Mouse || Movie || Music || Overlay || Pixelarray || Pygame || Rect || Scrap || Sndarray || Sprite || Surface || Surfarray || Tests || Time || Transform |
pygame.movie.Movie - load an mpeg movie file | load an mpeg movie file |
NOTE: pygame.movie currently does not work on windows with the latest pygame release. As no one has managed to get smpeg working there. The alternative is to use
pymedia
Pygame can playback video and audio from basic encoded MPEG1 video files. Movie playback happens in background threads, which makes playback easy to manage.
The audio for Movies must have full control over the sound system. This means the pygame.mixer module must be uninitialized if the movie's sound is to be played. The common solution is to call pygame.mixer.quit - uninitialize the mixer before the movie begins. The mixer can be reinitialized after the movie is finished.
The video overlay planes are drawn on top of everything in the display window. To draw the movie as normal graphics into the display window, create an offscreen Surface and set that as the movie target. Then once per frame blit that surface to the screen.
Movie.play - start playback of a movie | start playback of a movie |
Movie.stop - stop movie playback | stop movie playback |
Movie.pause - temporarily stop and resume playback | temporarily stop and resume playback |
Movie.skip - advance the movie playback position | advance the movie playback position |
Movie.rewind - restart the movie playback | restart the movie playback |
Movie.render_frame - set the current video frame | set the current video frame |
Movie.get_frame - get the current video frame | get the current video frame |
Movie.get_time - get the current vide playback time | get the current vide playback time |
Movie.get_busy - check if the movie is currently playing | check if the movie is currently playing |
Movie.get_length - the total length of the movie in seconds | the total length of the movie in seconds |
Movie.get_size - get the resolution of the video | get the resolution of the video |
Movie.has_video - check if the movie file contains video | check if the movie file contains video |
Movie.has_audio - check if the movie file contains audio | check if the movie file contains audio |
Movie.set_volume - set the audio playback volume | set the audio playback volume |
Movie.set_display - set the video target Surface | set the video target Surface |
Load a new MPEG movie stream from a file or a python file object. The Movie object operates similar to the Sound objects from pygame.mixer.
Movie objects have a target display Surface. The movie is rendered into this Surface in a background thread. If the target Surface is the display Surface, the movie will try to use the hardware accelerated video overlay. The default target is the display Surface.
Starts playback of the movie. Sound and video will begin playing if they are not disabled. The optional loops argument controls how many times the movie will be repeated. A loop value of -1 means the movie will repeat forever.
Stops the playback of a movie. The video and audio playback will be stopped at their current position.
This will temporarily stop or restart movie playback.
Advance the movie playback time in seconds. This can be called before the movie is played to set the starting playback time. This can only skip the movie forward, not backwards. The argument is a floating point number.
Sets the movie playback position to the start of the movie. The movie will automatically begin playing even if it stopped.
The can raise a ValueError if the movie cannot be rewound. If the rewind fails the movie object is considered invalid.
This takes an integer frame number to render. It attempts to render the given frame from the movie to the target Surface. It returns the real frame number that got rendered.
Returns the integer frame number of the current video frame.
Return the current playback time as a floating point value in seconds. This method currently seems broken and always returns 0.0.
Returns true if the movie is currently being played.
Returns the length of the movie in seconds as a floating point value.
Gets the resolution of the movie video. The movie will be stretched to the size of any Surface, but this will report the natural video size.
True when the opened movie file contains a video stream.
True when the opened movie file contains an audio stream.
Set the playback volume for this movie. The argument is a value between 0.0 and 1.0. If the volume is set to 0 the movie audio will not be decoded.
Set the output target Surface for the movie video. You may also pass a rectangle argument for the position, which will move and stretch the video into the given area.
If None is passed as the target Surface, the video decoding will be disabled.