|pygame.movie.Movie||-||load an mpeg movie file|
NOTE: On NT derived Windows versions (e.g. XT) the default SDL directx video driver is problematic. For pygame.moviepygame module for playback of mpeg video, use the windib driver instead. To enable windib set the SDL_VIDEODRIVER environment variable to ‘windib’ before importing pygame (see the pygame.examples.movieplayer.main()play an MPEG movie example).
Pygame can playback video and audio from basic encoded MPEG-1 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.mixerpygame module for loading and playing sounds module must be uninitialized if the movie’s sound is to be played. The common solution is to call pygame.mixer.quit() 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.
Videos can be converted to the .mpg file format (MPEG-1 video, MPEG-1 Audio Layer III (MP3) sound) using ffmpeg video conversion program (http://ffmpeg.org/):
ffmpeg -i <infile> -vcodec mpeg1video -acodec libmp3lame -intra <outfile.mpg>
|pygame.movie.Movie.play||-||start playback of a movie|
|pygame.movie.Movie.stop||-||stop movie playback|
|pygame.movie.Movie.pause||-||temporarily stop and resume playback|
|pygame.movie.Movie.skip||-||advance the movie playback position|
|pygame.movie.Movie.rewind||-||restart the movie playback|
|pygame.movie.Movie.render_frame||-||set the current video frame|
|pygame.movie.Movie.get_frame||-||get the current video frame|
|pygame.movie.Movie.get_time||-||get the current vide playback time|
|pygame.movie.Movie.get_busy||-||check if the movie is currently playing|
|pygame.movie.Movie.get_length||-||the total length of the movie in seconds|
|pygame.movie.Movie.get_size||-||get the resolution of the video|
|pygame.movie.Movie.has_video||-||check if the movie file contains video|
|pygame.movie.Movie.has_audio||-||check if the movie file contains audio|
|pygame.movie.Movie.set_volume||-||set the audio playback volume|
|pygame.movie.Movie.set_display||-||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.mixerpygame module for loading and playing sounds.
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.