documentation index ◦ reference manual ◦ function index

# Movies

Ren'Py is capable of playing MPEG-1 movies. This allows you to include video as part of your game. There are two ways that this can be done. Displaying video in fullscreen mode allows video to be scaled up to very large sizes, while displaying video in a displayable allows it to be blended with images and text.

Displaying a video fullscreen allows it to take advantage of hardware decode and scaling support. The downside of fullscreen mode is that nothing else can be displayed while the movie is being displayed.

Whenever a movie is playing, it is expected to provide all sound that the user hears. Ren'Py disables sound hardware for the duration of the movie.

The easiest way to display a movie fullscreen is to display it using the renpy.movie_cutscene function. This function displays a movie for a specified length of time. When that time has elapsed, or when the user clicks to dismiss the movie, the movie ends and the function returns.

Function: | renpy.movie_cutscene | (filename, delay=None, loops=0):

This displays an MPEG-1 cutscene for the specified number of seconds. The user can click to interrupt the cutscene. Overlays and Underlays are disabled for the duration of the cutscene.

filename - The name of a file containing an MPEG-1 movie.

delay - The number of seconds to wait before ending the cutscene. Normally the length of the movie, in seconds. If None, the length of the movie will be automatically determined. If -1, the cutscene will not automatically terminate, and will continue until the user clicks.

loops - The number of extra loops to show, -1 to loop forever.

Returns True if the movie was terminated by the user, or False if the given delay elapsed uninterrupted.

    $ renpy.movie_cutscene("On_Your_Mark.mpg", 394)

Displaying a movie in a displayable is more difficult, but it allows the movie to be mixed with rendered text and graphics. A downside of this method is that the screen needs to be re-rendered with each frame, a process that may be unacceptably slow when the screen is large. We don't recommend this when the size of the movie displayable is larger that 640x480.

To display a movie in a displayable, we must start the movie and show a Movie displayable on the screen. The movie is then displayed on the screen along with any other widget. When we no longer want to show it, we need to stop the decoding of the movie and hide the displayable.

Function: | Movie | (fps=24, style='default', **properties):

This is a displayable that displays the current movie. In general, a movie should be playing whenever this is on the screen. That movie should have been started using renpy.movie_start_displayable before this is shown on the screen, and hidden before this is removed.

fps - The framerate that the movie should be shown at.

Function: | renpy.movie_start_displayable | (filename, size, loops=0):

This starts a MPEG-1 movie playing in displayable mode. One or more Movie widgets must be displayed if the movie is to be shown to the user.

filename - The filename of the MPEG-1 move that we're playing.

size - A tuple containing the size of the movie on the screen. For example, (640, 480).

loops - The number of additional times the movie should be looped. -1 to loop it forever.

Function: | renpy.movie_stop | (clear=True):

This stops the currently playing movie.

    init:
        image movie = Movie()

    $ renpy.movie_start_displayable("bg.mpg", (640, 480), -1)
    scene movie
    show eileen happy

    e "I'm standing in front of a movie."

    e "Isn't that keen?"

    hide movie
    $ renpy.movie_stop()

documentation index ◦ reference manual ◦ function index