Movie — Ren'Py Documentation

### Navigation

- index
- next |
- previous |
- Ren'Py Home |
- Ren'Py Documentation

# Movie

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

- Theora
- V8
- 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
- WebM
- 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.

    $ renpy.movie_cutscene("On_Your_Mark.mpg")

`renpy.` `movie_cutscene`(filename, delay=None, loops=0, stop_music=True)

  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, then the delay is computed from the number of loops (that is, loops + 1) * the length of the movie. If -1, we wait 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.

## 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."

`Movie`(fps=24, size=None, **properties)

  This is a displayable that shows 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.)

### Navigation

- index
- next |
- previous |
- Ren'Py Home |
- Ren'Py Documentation