This patch shows some fundamental techniques for playing a video in Max.
One way to make video respond to audio in Max, is to detect some significant event in an MSP audio signal, and use that to trigger something in Jitter. This patch demonstrates one case of that. It uses an event in an audio stream to trigger the display of a frame of a movie. Every time the phasor~ jumps down to 0, a bang is sent to the jit.qt.movie causing it to display the current frame of the movie loaded into it.
A video matrix, such as comes out of jit.movie, has four planes of data, representing alpha, red, green, and blue. The alpha channel contains information about the opacity of the other three planes—a factor that can be used when mixing/compositing with another image. Normally the values in the alpha channel are all set to 1., meaning full opacity. However, if some values in the alpha channel are 0., the image will be transparent in those pixels, allowing another image to show through.
Here is a patch for choosing between multiple video effects.
A jit.movie or jit.qt.movie object doesn't automatically provide a notification when it reaches the end of a video. However, it's easy enough to obtain such a notification by checking to see when the video's current time becomes equal to its total duration.
You can switch between multiple videos without starting from the beginning of each clip after each every switch by acquiring the time the clip was stopped as the next starting point.
You can easily jump to different parts of the movie using the readymade object called playbar.
To jump immediately to a new location in a movie, you can send the frame message to jit.movie (or jit.qt.movie). To crossfade to a new location, instead of a jump cut, you need to be playing the video twice, and crossfade from the current video to the second video, after which you can stop playing the first video. To do that again, you can just reverse the process: start the first video at the new location, crossfade back to the first video, and stop playing the second one.
You can make a crossfade between two videos or betwen two sounds by multiplying the amplitude of one of them by values going progressively from 1 to 0 while you multiply the other by values going progressively from 0 to 1. In this example, we use a slider object that outputs values from 0 to 1 to control the volume of two movie soundtracks, using the vol attribute of jit.qt.movie (or jit.movie).
This patch allows you to try different exponentialities of fade-in/fade-out of a video.