Movie Playback Functions

Movies are complicated things in windows. You can't just take any old movie file and throw it in a game and expect it to work on other people's systems. Besides that, it is rude to put a big movie file in a game. Most people will reflexively hit ESC anyway because thats what they are accustomed to doing when assaulted with an FMV. However, movie functionality is provided for those who have some legitimate need for it. BUT YOU MUST FOLLOW THESE RULES:

DO NOT USE DIVX OR XVID OR MPEG2. These codecs do not come with windows, and the player might not have installed them manually. Use cinepak, indeo, video-1, or even RLE. The compression might be cruddy, but at least it will work.

If you are thinking about making a video an integral part of your game, you MUST CONTACT ME to discuss it so I can help you make sure you're doing it right. If you are including a video for some lame purpose like an intro screen are something then I suggest that you not do it, and if you must indeed do it then I suggest that you contact me to get advice on doing it right.

Even the basic codecs (including cinepack) might not be installed on Windows server platforms. I know for a fact they dont work on my Windows 2003 at the office.

There are basically two modes to movie playback--simple and advanced. Simple mode consists of PlayMovie, which will just play a movie fullscreen through to completion and is suitable for intro movies and such. Advanced mode uses MovieLoad to load the movie and MovieClose to close it and is split into two use cases:

  • MoviePlay/MovieGetImage which will play a movie through to completion but allow you to control the rendering of the movie via MovieGetImage and your own calls to blit(), etc. --and
  • MovieSetFrame/MovieNextFrame/MovieSetFrame which will let you zip around in a movie and pick the frames you want. MovieRender will have to be used to decode the movie after youve skipped around (..i think.)

There are a few other functions which you may find useful

There are likely horrible synchronization bugs in the movie code. If youre using it and run into problems, we'll see what we can do to straighten it out.

  • AbortMovie() (simple) Aborts a movie played by PlayMovie
  • MovieClose() (advanced) Closes a movie handle previously opened by MovieLoad
  • MovieGetCurrFrame() (advanced) Returns the current frame index of a movie
  • MovieGetFramerate() (advanced) Returns the framerate of the movie
  • MovieGetImage() (advanced) Gets an image handle for the current movie frame
  • MovieLoad() (advanced) Load a movie file for later use
  • MovieNextFrame() (advanced) Advances the movie to the next frame
  • MoviePlay() (advanced) Starts playing a movie handle
  • MovieRender() (advanced) Internally decodes the current frame of the movie
  • MovieSetFrame() (advanced) Moves the movie to the specified frame
  • PlayMovie() (simple) Plays a movie fullscreen
  • Talkback

    There are no talkbacks on this documentation page yet. Post the first?

    Post a new comment?

    Ben McGraw's lovingly crafted this website from scratch for years.
    It's a lot prettier this go around because of Jon Wofford. is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.