Embedding Movies Files In Quartz Composer : Undocumented Feature Tutorial

It is possible to embed a movie in Quartz Composer, by following these steps:

1. Convert the movie to an image sequence.

2. Convert that sequence to a multipage document (like a pdf or gif).

3. Place an Image patch on the surface of the QC Editor.

4. Select the Image patch. Go to Settings, using the Patch Inspector. Under Image Options, select Extract All Images. Choose Import From File, choose your file, then select Open to load it into the Image patch.

Now, the Image patch will output a structure of all frames from your movie/image sequence. By connecting a Structure Index to the output of the Image patch, and then connecting the output of the Structure Index patch to a Billboard (or other patches that render an input image), one will render the first frame in the sequence.

6. Connect an Image Dimensions patch to the output of the Structure Index. Connect the Width and Height outputs to the Width and Height Inputs of the Billboard patch. To obtain both Width and Height Inputs for the Billboard patch, select the Patch Inspector, go to Settings, and select Custom Size.

One should now have a Billboard rendering the first frame of the Image Sequence, referencing said Image for it's Width and Height.

7. Now, select another Structure Index. Connect the output of the Image Patch to this Structure Index, and the output to the existing Billboard.

By using an Interpolation or LFO patch, one could play through frames, but a good starting point for movie playback is to create a looper macro with definable FPS. There are multiple ways to achieve this. An easy way is to :

8. Take the Patch Time, and multiply by an Operand using the Math patch, which will become the Frame Rate of the playback.

9. Then, take a Math Expression patch and enter "a % b" into Settings.

In this case, "a" will take the output of the Math patch. Place a Structure Count patch on the Editor, connect the input to the output of the Image patch, and the output Count to input "b" on the Math Expression patch.

10. Take the second Structure Index that you created, and which should be connected to the Billboard, and connect the output Result of the Math Expression patch to the Index input of the Structure Index. Enter in the desired playback rate, by changing the multiplicative Operand on the Math Patch. Publish this input and call it Frame Rate.

...and you're done! One should have a qtz that is playing back an embedded movie, with ability to define the rate of playback.

For an example of this, reference the attached file in the Box Widget account.

Notes:

I've tested this with multi-page pdf's and gif images, though I'm guessing that multi-page tiff would likely work as well.

For creating your own from scratch, it's easy to convert movies to Image Sequences using Quicktime's Export to Image Sequence ability. From that point one, can use a utility program to create a gif, or use Preview to convert to pdf.

I would think it would be possible to merge a pdf document by using Preview, and according to some unofficial documentation I've read, but when I drop multiple pdf's onto the sidebar in Preview, it doesn't give me a "bound"/merged document. I've used an older free utility called "pdfsam", which will successfully create a merged pdf document with correct ordering.

For the sake of size (and cost of quality), one may want to reopen the merged pdf in Preview and Save using the "Reduce File Size" Quartz Filter option.

The creation of Image Sequence from movie, to merged pdf or gif file seems like something that should be scriptable, to avoid having to use various applications to prep the Image document, but I haven't investigated the automation of that process yet.