Introduction
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.
While the imovie object provides a lot of functionality for working with video media within Max, the Jitter set of object extensions for Max provide much more. Once you get comfortable with imovie, you'll find it easy to use its Jitter equivalent jit.movie or jit.playlist, which allows you to not only play video but send it into the Jitter matrix processing system to dynamically add effects, perform compositing operations, and develop more advanced video-based systems. (Incidentally, the imovie object has been a part of Max since the early '90s, long before Apple decided to sell a program by that name.)
To open the tutorial patch, click on the green Open Tutorial button in the upper right-hand corner of the documentation window.
Basic imovie operation
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 . 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 message will read in a specified movie file; will cause it to begin playing; will cease playing the file. Try clicking these message boxes. Note that begins the movie at the beginning every time you send that message.
Next is a row of five different imovie object to change the playback speed of the movie clip, where the value means normal (forward) playback. A of will play the movie backwards at normal speed; moves the clip forwards at ½ speed. Start the movie's playback (with the message), then click on the messages to see the alteration. Note that sending the message pauses the movie where it is. A subsequent message (or any other speed) will pick things up where it left off.
messages. The message tells theWhen the movie reaches the end, you can click 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.
message again to restart it. However, just below the messages, we can see an alternative to constant restarting: using the message to cause the video file to loop over and over. Click on theThe 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 message causes imovie to send the movie’s duration (in milliseconds) out the leftmost outlet of the object.
Using the File Browser
The messages we’ve just tried give us basic control of the imovie object, but having to change the message any time that we want to add a new file would be rather onerous. One option is to change it to a 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 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.
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.
Using the mouse to alter rate
During our first experiments with this patch, we used
messages to determine the speed of playback; we also noted that rates greater than caused forward playback while rates less than 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 to (or greater, if your screen is wider than pixels wide). The result is used to create a 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 message) and turn on looping (with the toggle box connected to the 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.
Using the mouse to alter playback point
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 message box found just above the 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 imovie inlet. The imovie object treats incoming integers as “current position” settings, and the movie will immediately jump to that position.
– (for the "countdown" video) and sent to theBy 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
to . If we do this (using the message box), vertical mouse moves will now allow us to maneuver through the movie in frame-by-frame steps.Switching between several movies
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 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 , , , and , respectively) are each mapped using the select object to a statement (followed by a message to restart the video). If you click on the four-part 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.
Summary
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.
See Also
Name | Description |
---|---|
imovie | Play video |