MovieMaker Processing Library
Published May 18th, 2006 in ITP, blog, p5, teaching_Update: MovieMaker is now part of Processing’s core video library so this post is now irrelevant!
Based on some code from Shawn Van Every and Dan O’Sullivan, I’ve created a Processing library that allows you to take any pixel array (from the window or from a PImage) and create a quicktime movie.
E-mail me bug reports, questions, comments, etc.!
Example code:
import moviemaker.*;
MovieMaker mm;
float theta = 0;
void setup() {
size(200,200);
mm = new MovieMaker(this,width,height,"p5test.mov", MovieMaker.JPEG, MovieMaker.HIGH,30);
}
void draw() {
background(sin(theta)*127+127,255,cos(theta)*127+127);
theta += 0.05;
loadPixels();
mm.addFrame(pixels,width,height);
}
public void mousePressed() {
mm.finishMovie();
}
Available constants:
code: RAW, JPEG, CINEPAK, SORENSON, VIDEO
quality: LOW, MEDIUM, HIGH, BEST
58 Responses to “MovieMaker Processing Library”
- 1 Pingback on Nov 8th, 2006 at 8:10 am
- 2 Pingback on Nov 19th, 2006 at 1:16 pm
- 3 Pingback on Mar 12th, 2007 at 10:58 am
wow, that’s great news daniel.
I’ve just done a quick test on windows with your code and as far as I see everything works nicely. I’ve done another sketch trying to record from a webcam and there seem to be some drops, but I have to test it deeper.
anyway, this is a great tool. Thanks very much for sharing.
Good resource Dan,
I started writing some code myself based on http://www.onjava.com/pub/a/onjava/2003/02/19/qt_file_format.html?page=1
but ill put that on hold and test this out. ill let you know how it goes.
Ram
Awesome! I was just telling one of my best friends last night that I think looking at art made in processing is cool, but watching it being made is cooler. Processing programs that run over night might become more interesting if you can timelapse the rendering process.
this seems like it could make that a little easier.
Brilliant! This is exactly what we need over here. Like Ram (great name), we actually started building a Quicktime movie exporter, but got distracted from another library project. Let us know if you want some code help, we’ll send over our efforts.
I’m doing some experiments right now, everything works well, except I keep getting “Temporal compression not supported. Switching modes”. I’m on a Mac OS 10.4.4, Processing 0115, Quicktime 7.0.4.
Ah, oops, yes, the “Temporal compression not supported. Switching modes” message is on purpose. I should take it out, was just for my own debugging. What I’m doing is determining what type of compression is being used and then adding frames to the movie with code based on that determination. I’m out of town this weekend, but I’ll be cleaning / fixing up the code next week when I get back!
Hi,
Sorry if this isn’t too relevent but you guys seemed to be sensible people to ask. I’m using ubuntu, and I’ve written a patch for pure data (pdp) to play and synch two video streams, but it doesn’t like my quicktime files - it tells me it doesn’t support the codec. They are just the standard output from finalcut pro 5, totally uncompressed. I’ve tried loads of things but nothing works. Any ideas? Would your exporter dp the trick?
Gr8 tool! thanks Daniel! i’ll try it soon on a project!
This makes the world better - Thanks Daniel!
Thanks for the library! One problem: my movies are washed out in blue. Frame rate is great though. Any thoughts?
Doh. I’m runing a macbook 2.0 (mactel).
It works well Dan on my windows, the only problem I have is that the resulting video is always at great fps… doesn’t matter, I’ll slow down them externally. Anyway it’s a great library, very useful for processing.
Thanks for all the comments, I\’ve been traveling a lot this summer, but I\’m back now and plan on updating the library and documentation soon. Suggestions, bug reports, etc. welcome!
Hello,greetings from Greece.
I just downloaded processing and your moviemaker.
I am not a programmer but i like to experiment with moving images and staff.
I would like to export the things i see in the processing but i can’t understand how. Would you have the patiens to explain to me what i hane to do?
Thank you in advance
i need that so often but i’ve been too lazy try understand the horribly documented quicktime api, i’m happy you did
thanks sooooo much for this!
Fantastic Daniel!
Greetings from Italy.
I’ve just downloaded the library, and I’m running a test with LiveInput, this is a small piece of code that captures inputed sound and makes graphics react to this input. While trying to use MovieMaker to record the movements, the app runs to slow and the quicktime seems to be corrupted.
Any work around for this?
By the way I think it’s a great development.
Can you let me know what OS you are using (and the resolution of your app)? It will indeed make the applet run slower, especially if it is high resolution (640×480 or more.) As far as the quicktime being corrupted, did you include a call to the \”finishMovie()\” method? The qt won\’t work unless that function gets called. . .
Someday soon I will update and work on this library more!!!!
Well I’m using Mac OS X Version 10.4.5
Is there a excellent codec that export a high quality movie, I’m using VIDEO and BEST as the values and still get a litle bad quicktime.
I’ve tested this with a smaller applet, mine was 1024×768, and I think the problem was wright there because now it runs well
thks again
I’ve report this bug:
2006-09-25 10:53:36.731 java[327] *** -[NSBundle load]: Error loading code /Library/InputManagers/MagicMenuEnabler/MagicMenuEnabler.bundle/Contents/MacOS/MagicMenuEnabler for bundle /Library/InputManagers/MagicMenuEnabler/MagicMenuEnabler.bundle, error code 2 (link edit error code 0, error number 0 ())
then the .mov saving start but the .mov produced present only the BLUE channel saved in… maybe
i’ll check properly anyway i’m running MacOsX 10.4 shouldn’t be a problem but i’got a MAC INTEL UNIVERSAL
thanks for this library!
Hmmmm, I’ll have to test this on Mac Intel at some point and see if I can get it working. Oh, and regarding codecs, you can use any of the constants available in StdQTConstants (I just need to implement them all in the library. . ).
thanks a lot, daniel, for this great library.
is there any reference somewhere to deepen this useful tool?
hibernia
hi daniel,
i’ve been using movie maker a lot and simply love it.
do you have an idea if it’s possible to get the h.264 codec working?
i’m wondering if java is the limit.. (currently running osx 10.4.8)
thanks for all
greetings from germany
stefan
Hmmm, yes, I’d like to support all codecs. Currently, I’m getting the available codecs as constants from StdQTConstants. I don’t see one for H.264, but there is one for H.263.
I will implement it at some point as part of the library, but for now you should be able to do this:
mm = new MovieMaker(this,width,height,”p5test.mov”, StdQTConstants.kH263CodecType, MovieMaker.HIGH,30);
You will likely need to import StdQTConstants:
import quicktime.std.StdQTConstants;
Let me know if it works! I’ll add more codecs soon!
hi daniel,
yes thanks, well i’ve had a look into your code meanwhile and simply added the h.263 to the other VARIABLES, which is so comfortable. (personal hack, hope that’s alright for you - i definitely won’t spread it around)
it helps a lot to know you didn’t find the h.264 either, because now i know it’s really not there. i was thinking that maybe i’ve got an old version of java - and since i’m such a bloody java rookie, i don’t even know where to look up my version number
hopefully apple will add h.264 for java soon, because after comparing a lot of codecs recently i found it’s so much better than everything else in almost any respect..
respect
stefan
who is responsible anyway, for bringing h.264 into java? sun?
I just installed this on the very fast, but very locked-down Dell PCs in our school’s computer lab. Works like a charm. Will give it a try on my toshiba crap-top when it gets back from the shop.
Thanks! This is a particularly useful library for those of use interested in producing video art in Processing.
.Liav
with mac intel 10.4.8 (NVIDIA GeForce 7600) with processing 119:
my qt test come out with wrong colors (switching from magenta to white),
under all parameter values. any suggestion? thank you!
Hey, thanks for the library!
I’m very excited to get using it, but I’m having the same problem as some others: the exported movies are washed out it blue. looks like the blue channel only, I think. I’m runinng an intel macbook. OSX 10.4.8
Good luck!!
chuck
I’m going to fix this bug this weekend, stay tuned!
HOORAAAAY!!! My hero!!
sorry sorry sorry…. stupid me… had to restart processing before it recognized the new library… oops!
Not to be a bother, but I’m really excitedly awaiting a library that will run on my intel mac. I do experiments with live video and I’d love to capture it.
I’m planning on working through some of your Nature of Code coursework soon!
Good luck!
Daniel, i dont understand exactly how to control the movie frame rate .. i seemed to see a trend and i just wrote in my hack to do the same. however i would like your thoughts on it.
Case: Camera rate is 12 fps, but the o/p movie post processing should be around 20 fps -> there seems to be a fair amount of numbers you need to twist :-).
would love to hear your thoughts on this
Hey Ram,
Does it not work if you pass in the integer 20 to the constructor?
mm = new MovieMaker(this,width,height,\”test.mov\”, MovieMaker.JPEG, MovieMaker.HIGH,20);
If you look at the source code you\’ll see this rate value is used when adding frames using the addSample() method.
-> regd movie write speeds, no that does not work Dan, i think when you write it you need to tell it to write faster so if you are reading frames at 12 fps and you need to write at 20 you need to tell the that you need to write twice as fast as you are reading from the camera. so write speed value will be close to 60 fps. its weird the way it works. If it directly works with slotting in a number that would be great !!
Thanks
Ram
Ah, this is because MovieMaker doesn’t care what the camera framerate is. It only cares about what the display framerate is (assuming you are adding the pixel array with every frame.) Two possible fixes — (1) set the framerate of the applet to the same as the camera framerate. (2) Add the pixels of the video source to the movie directly in the captureEvent() function.
Hi Shiffman !:
I was working around with moviemaker. It goes fine but with certain issues:
1) How could it use it with OPENGL rendering?
2) the framerate of my recorded movie looks faster than the realtime applet. how could I fix it up? (I\’m trying to record some audio-video live performance)
3) using mm directly I got some frezzed frames in the applet window so I decided to run it in another thread (my class follow) but I get the framerate trouble and also some black frames in the movie. Any thoughts?
thnk you very much !!! (sorry.. I\’m on vacation; plenty of time for disturbbing :))
1) OPENGL mode should work just fine. Does it not?
2) The framerate for the movie is fixed to whatever you specify. This is not recording your screen in real-time, it is adding frames of your applet one at a time to the movie (and playing them back at whatever framerate you set in the constructor.)
3) Writing a movie file while running an applet is slow, and will cause your applet to run very slow. The library is not recommended for use in real-time recording. If you want that, you may just want to record the video out of your machine to directly. Also, doing a separate thread will not help matters as you want each frame to be added to the movie precisely at the end of each draw() cycle. I suppose you could make a thread for every addFrame() call. . .
oh.. I see.. I’ll try adding frames on a diferent thread and see what happens..
thank you very very much !
Hi, can I use your library for a web project? I mean will it save the video in a folder on the webserver?
thanks
Unfortunately, the MovieMaker library will not work in an applet on the web (only running in Processing locally.)
Hello.
Im working with a project for capturing images, videos and audio from a webcam. Can the library record the sound in the movie as well?
Nope the library doesn’t do sound. You’d have to capture that separately.
Thank you very much for making this. Because of people like you, the free tools are getting to be even better than the commercial ones!
Thanks for your project. I like this site. KEEP IT UP..G
Hi Dan!
working with MovieMaker library on Processing 0124 I get this
… .java:362:1:362:10: Semantic Error: Type “MovieMaker” is imported on demand from package “processing.video” and package “moviemaker”.
but on Processing 0121 is working fine, do you know why?
Thanks!
Hi Dan,
I got the same error as Claudio. Although when using MovieMaker without invoking the video library it works fine …
I’m also using 0124.
Any clue? Thanks.
Cheers!
This is the problem.
Wow, this is great.
any chance it’ll be expanded to loading movie files or producing a different file type?
Dan,
This is a wonderfully useful tool. I just solved a problem that may be confusing for others should they encounter it. The error message follows:
/tmp/build38572.tmp/Temporary_4127_7447.java:21:1:21:10: Semantic Error: Type “MovieMaker” is imported on demand from package “moviemaker” and package “processing.video”.
When using the video library for live video input, you import something else which is also called MovieMaker. To distinguish between the two, you need to write moviemaker.MovieMaker or video.MovieMaker whenever you are instantiating a MovieMaker or accessing class attributes. Hopefully this will save someone a few minutes of headscratching.
Thanks again for the great library.
Dear Daniel
I receive the following message and am unable to finish off the movie :
quicktime.std.StdQTException[QTJava:6.1.6g],-2014=invalidDuration,QT.vers:7168000
at quicktime.std.StdQTException.checkError(StdQTException.java:38)
I’m a new comer and a little lost. That said I have got it to work with your example code above
Stefan and all, I recall reading recently something about the constants for the H.264 codec and another (MPEG4 maybe?) are now included in the Quicktime for Java libraries.
Of course I can’t find the page anymore, but there’s a little info here that is relevant from Chris Adamson who contributes to O’Reilly: http://lists.apple.com/archives/QuickTime-java/2005/Aug/msg00049.html
Great work!
Have you experimented with generating NTSC or PAL dimension movies and importing them into Final Cut or other video editing software? I’m about to try this…
best
Matt Rogalsky
Hi,
I am using a MacBook with tiger 10.4.
When I run the example code in
http://www.processing.org/reference/libraries/video/MovieMaker.html
I get this error:
The specified codec is not supported, please ensure that the parameters are valid, and in the correct order.
I’ve tried different constants: StdQTConstants.kH263CodecType, and all the MovieMaker ones.
I have quicktime 7, updated to the latest version as of today.
I can’t figure out where the codec lives on my computer or how to not get this error…
Thank you for your help,
diN0bot
Hello,
I’m having a similar problem with the message posted on 4th January 2007 (question no.2).
When I’m creating a movie, the rendered version is much faster than it normally is, probably because of a frameRate issue. I declare the framerate as 30 in the setup and 30 again when creating the new MovieMaker object, but the resulting animation is almost four times faster than my original intentions.
I’m not very confident with coding so i don’t know if this is because of something that I’m doing wrong, can you help me out please?
Besides this, animations look great!
By the way, I’m using an intel macbook, OSX 10.4.8.
Thank you,
Emre.