Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
If you've created a dynamic drawing in Processing, you may want to be able to save your results and export them as a movie that you can then save as a movie file and share with other people. Previously, to do this you needed to export the files and you needed to stitch them together in a video editing program like Premiere Pro or Final Cut. But Processing now has built in a special tool called MovieMaker that greatly facilitates this process. To do that, I'm going to use a sketch that I used on tracing the mouse just a few movies ago.
This is the movie from chapter, the first one, about tracking the mouse. I'm just going to run the program right here, just for a few seconds, and then I'm going to quit it. What you'll see is I've added one important line, and it's this one down here. And what this line does is it saves a still image of the display window every time it goes through the loop. So that saveFrame is the function. And then what I've done here is I've given it a specific way that I want to save the frame. So first what I've done is I say I want it to create a folder called Frames.
That's what the first part is. And then the slash is I want it to go through and sequentially number every image that it puts in there with a four-digit number, so it will show as 0000, 0001, and so forth. Also, by putting the extension on there, .PNG, it saves them as PNG files, which are good for a lot of image processing. And so, if we go back to the Sketch folder-- let me just move this over for a second-- you'll see that now we have a Frames folder. And in there, the sketch didn't run for a very long.
It ran for 44 frames, and you can see how it fills up. Now, what I want it to do is take those and stitch them back into a single movie. I just come back to Processing and go to Tools, to MovieMaker. Now, if you're experiencing any technical difficulty in trying to get this open, if you get an error message, one possibility is that you check to see if there are any spaces in the file path that lead to the MovieMaker. Sometimes that can fix problems. With MovieMaker, all you need to do is get the folder that contains all of the frames. Now, if I go back to my Sketch folder and I just back up one step, there I've got my Frames folder, and I can just drag that and drop it in, and it populates with the file path.
Now, by default, it assumes that I'm doing a 640 x 480 movie, and that's usually a good choice. But that is not what I had in this particular case. You may recall I actually had it 600 pixels wide by 200 pixels tall. All I have to do is come right here and do the same size as the original. Also, my frame rate for the drawing was 10 frames per second. Now, normally, you would want to do faster than that, but I actually wanted to have some space up here between the dots, so I slowed it down on purpose. So, I'm going to return that to 10, just like that. Then I'll click Create Movie.
Actually, you do have the choice of dragging in a sound file now. If you're trying to do a movie, this will not be synchronized; they will just be independent coexisting files. So, I'm not going to worry about that one right now. But that is an option. I'm just going to click Create Movie, and now it's going to ask me where I want to put it and what I want to call it. Now, by default, it opens up the same folder that had the original Images folder in it. I'm going to call this one dots and press Save. What you see is I immediately get two files over on the right side, in the Sketch folder: one is a TMP file, and the other one is an actual QuickTime file.
If I double-click on that, I get a QuickTime window, and when I press play, I get a repeat of my sketch. Now, normally, for something like simply following a mouse around, this may not be the one that you want, but if you have created an animation in Processing, especially one that's responsive to the user input, then this would be a very good way to go. And it's certainly easier than having to take things to an external program like Final Cut or Adobe Premiere and try to put them together there. It's one of the big advantages, I find, in the Processing 2.0.
Get unlimited access to all courses for just $25/month.Become a member