In this tutorial, we will be focused on the display of movies using Apple’s QuickTime video playback tools. We will also learn about using Max’s built-in file browser to find useful video content, and learn a few ways to manipulate movie playback in realtime.
Apple’s QuickTime system is well-known as a movie-playing mechanism, but it also provides software developers with a rich toolbox for playback and manipulation of many types of media content. The QuickTime developer tools were used to create several objects for Max; one of the most important is the imovie object, which displays video content inside of a patcher. We will use imovie to load and play videos as well as manipulate the playback speed and playback location. We will also learn to load and switch between videos, opening the door for interactive performance patches.
This file loads with a number of subpatches and one large display area - this should initially be showing a number inside cross-hairs. This display area is actually the imovie object, and it allows you to embed a QuickTime movie clip directly inside a patcher. The number with crosshairs is a video clip that the object has loaded when we opened the patcher; it's called countdown15.mov. We will use this instance of imovie, along with several control messages, to display and control QuickTime movie playback.
Just above the imovie object is an array of message boxes that send commands to the object. The top four messages provide some basic commands: the read message will read in a specified movie file; start will cause it to begin playing; stop will cease playing the file. Try clicking these message boxes. Note that start begins the movie at the beginning every time you send that message.
Next is a row of five different rate messages. The rate message tells the imovie object to change the playback speed of the movie clip, where the value 1. means normal (forward) playback. A rate of -1. will play the movie backwards at normal speed; rate 0.5 moves the clip forwards at ½ speed. Start the movie's playback (with the start message), then click on the rate messages to see the alteration. Note that sending the message rate 0. pauses the movie where it is. A subsequent rate 1. message (or any other speed) will pick things up where it left off.
When the movie reaches the end, you can click the start message again to restart it. However, just below the rate messages, we can see an alternative to constant restarting: using the loop message to cause the video file to loop over and over. Click on the toggle box to turn on looping. Now you can see that the movie, upon reaching its end, will restart at the beginning – running forever.
The imovie object can also tell us things about the QuickTime movie currently playing. There are many different messages that can be used to query imovie information; you can find out about them in the reference manual pages. One of the most important pieces of information is the duration of the movie – the amount of time for a single iteration of a movie’s playback. This could be used to generate a music score, or just set up a display that helps show where we are in the film. In any case, sending the duration message causes imovie to send the movie’s duration (in milliseconds) out the leftmost outlet of the object.
The messages we’ve just tried give us basic control of the imovie object, but having to change the read message any time that we want to add a new file would be rather onerous. One option is to change it to a read message with no argument; this will open a dialog box that lets you pick any file on your computer system. However, the easiest way to load a movie is to drag a .mov file onto imove to watch it. You can get them from the finder, or by clicking the video icon on the left toolbar. This will open a drawer listing all movies in the database.
The file browser provides more ways to find and select files (of all kinds). You can open a file browser window by selecting Browse Files from the File menu. This presents a window with file names, file types, modification dates, and custom tags – all files that Max determined might be useful for your patcher programming.
The file browser opens with a Googlesque search box—instructions for sophisticated searches are right there on the page. If you are happy with a more generic list of files by type, look to the tree veiw in the lefthand plane. Click the triangle by "kinds" to see a list of common types. select one,and all of the pertenent files in the search path will be listed.
Where does the browser look for files? (A search of the entire hard drive would take hours.) If you select File Preferences in the Options menu, you will be presented with a window that lets you add or edit paths to any folder where you keep important resoources and work. Every time you launch Max a database is built listing the contents of these folders. This database is constantly updated. There is no need to quit Max if you make changes to your holdings.
Now that we have the list of available movies displayed, we can grab a movie by name and drag it onto the imovie object to open it. Click on one of the files by name (or any other column, really) and drag it to the patcher window. When you hover over the imovie object, you should see a blueish border appear in the object – this means that it can be a recipient of the file you are dragging. Releasing the mouse at this point will load the movie file into the imovie object.
During our first experiments with this patch, we used rate messages to determine the speed of playback; we also noted that rates greater than 0. caused forward playback while rates less than 0. caused reverse playback. We are going to use this concept, along with some mouse-tracking, to perform some realtime video scrubbing/scratching.
In patcher object labeled example 1, you will see that a metro is set up to poll a mousestate object, and the second outlet (the horizontal location of the mouse) is being used. The value is displayed and scaled (through a scale object) into a value that will range from -2. to 2. (or greater, if your screen is wider than 1024 pixels wide). The result is used to create a rate message that is sent to the imovie.
If we turn on the metro with the toggle box, we will see the horizontal mouse location being tracked in this portion of the patch. Start the movie (with the start message) and turn on looping (with the toggle box connected to the loop $1 message). Move the mouse across the screen – you will see it speed up, slow down and reverse direction depending on the current mouse position. Going “through zero” (producing positive numbers that move through zero and back into higher negative numbers) produces the typical scratching function we’ve come to identify as a useful VJ manipulation.
Turn off the metro for example 1, and turn on the metro for example 2. This small sub-patch is very similar to the first – we are tracking mouse movements and turning them into video playback messages. In this case, we are using the vertical mouse location to set the current playback position. In order for this to work correctly, you will need the duration of the current movie, which you can get by clicking on the duration message box found just above the loop selector at the top of the patch.
Once the proper duration has be communicated to our patch, we can see that changes to the vertical mouse position will be scaled to the range 0 – 10000 (for the "countdown" video) and sent to the imovie inlet. The imovie object treats incoming integers as “current position” settings, and the movie will immediately jump to that position.
By default, however, once the position is set it will just keep playing at its current speed. The behavior of QuickTime movies is that they are always running at their current rate; if you want to completely control the playback location of the movie, you will need to start by setting the rate to 0. If we do this (using the rate 0. message box), vertical mouse moves will now allow us to maneuver through the movie in frame-by-frame steps.
Another way that we can control the imovie output is by loading and switching between several movies. Unlike many other media-related objects, imovie can load several different movie files, then can use the switch message to jump among the files to determine which one is active.
The patcher object labeled example 3 is the area that shows how to load and cue multiple videos. In this case, four files are pulled from the search path and read into the imovie object through the message box at the top. Next, we have a key object watching user keyboard entry; the letters “a”, “s”, “d” and “f” (ASCII 97, 115, 100, and 102, respectively) are each mapped using the select object to a switch statement (followed by a start message to restart the video). If you click on the four-part read message box, the listed videos will be loaded. Now type “a”, “s”, “d” or “f” on the keyboard to select the movie you want to display. You can do this as rapidly as you wish; since the movie files are already loaded into the imovie object, there will be little delay when switching between them.
To remove the movie(s) loaded in imovie, use the dispose message.
We’ve focused on the imovie object, which allows us to play and manipulate video content. In addition to simply playing and stopping movies, we’ve learned to alter the playback speed with messages and with mouse movement; we’ve also learned how to use mouse movement to change the current playback position. Finally, we learned that imovie can have many movies loaded, and a simple patch can accept keyboard input and perform high-speed movie switching. All of this builds on the simple commands provided by the imovie object.