documentation index ◦ reference manual ◦ function index

# Movies

Ren'Py is capable of using ffmpeg (included) to play movies using the video codecs:

- Theora
- MPEG 4 part 2 (including Xvid and DivX)
- MPEG 2
- MPEG 1

and the following audio codecs:

- Vorbis
- MP3
- MP2
- PCM

inside the following container formats:

- Matroska
- Ogg
- Avi
- Various kinds of MPEG stream.

(Note that using some of these formats may require patent licenses. When in doubt, and especially for commercial games, we recommend using Theora, Vorbis, and Matroska or Ogg.)

Ren'Py expects that every movie will have an audio track associated with it, even if that audio track consists of nothing but silence. This is because the audio track is used for synchronization purposes.

Movies can be displayed fullscreen, or in a displayable. Fullscreen movies are the more efficient.

## Fullscreen Movies

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, stop_music=True):

This displays a fullscreen movie cutscene.

filename - The name of a file containing a 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.

stop_music - If True, stops the music channel while the cutscene is playing, and starts it again when the cutscene is over.

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")

## Movies Inside Displayables

A movie can also be displayed inside a displayable, allowing it to be combined with other things on the screen. To do this, one must first show a Movie displayable, and then play the movie on an audio channel. (We recommend using the movie channel for this purpose.)

    init:
        image movie = Movie(size=(400, 300), xalign=0.5, yalign=0.5)

    label movie_sign:
        scene black
        show movie

        play movie "incubus.mkv"

        "Wow, this movie is really terrible."

        "I mean, it stars William Shatner..."

        "... speaking Esperanto."

        "MAKE IT STOP!"

        stop movie
        hide movie

        "Thats... better."

Function: | Movie | (fps=24, size=None, **properties):

This is a displayable that displays the current movie.

fps - The framerate that the movie should be shown at. (This is currently ignored, but the parameter is kept for backwards compatibility. The framerate is auto-detected.)

size- This should always be specified. A tuple giving the width and height of the movie.

The contents of this displayable when a movie is not playing are undefined. (And may change when a rollback occurs.)

documentation index ◦ reference manual ◦ function index