I use a 450 MHz G4 Cube, so I tend to look hard at minimizing any large drains on my CPU. Such drains include playback of large video files (such as the 540p version of MacBreak). So I've been experimenting on and off with faster ways of playing back QuickTime movies. Here are my findings.
First, do not use
NSMovieView. In my app, the
NSMovieView used 50% of my CPU at all times — even when the movie was paused. Bad, bad, bad. And the frame rate sucked, too. (UPDATE 23:50 PDT: It seems like
NSMovieView simply draws the entire frame periodically and unconditionally. The CPU usage changed based on the size of the window.) When I replaced it with
QTMovieView, the CPU usage went way down, and the frame rate became watchable.
Second, Apple has a document called Enhancing Movie Playback Performance. Read it, learn it, live it.
Some of its information bears expanding-upon, though:
Remember MoviePlayer? It had two checkboxes for enhancing speed:
Preload is obvious; it corresponds to
LoadMovieIntoRam. Cache hint is not so obvious; what it does is keep movie data in RAM after it has been played (for looping). This corresponds to the
Note that in MoviePlayer, you could only set preload options per-track (there was a “Movie” category, but you could not set preload options for it). So this actually corresponds to
LoadTrackIntoRam. I find
LoadMovieIntoRammore useful for my situation; obviously, you should use whichever one of
LoadMediaIntoRamis appropriate for yours.
Preloading all of a movie is very expensive, especially if the movie is large (MacBreak takes about 20 seconds to load — that's forever in user time). Use it only if you have to, and show a progress indicator if you do. If you can, preload sections at a time — I might, for example, load 30 seconds every 1 second starting from file open.
Third, I suggest making sure that your
QTMovieView is set to preserve aspect ratio. I don't know whether aspect ratio distortion has a negative effect on QT performance — especially if the movie is being scaled anyway — but having this turned on can't hurt.