Loading...
Logo
Processing Forum
Hey all,

I've created a small image array and I'm trying to experiment with exporting the sketch to a .mov where I can later use it in iMovie. I read this thread and tried implementing the advice from there into my own code. However, I'm running into trouble and can't actually export anything (error message below). 

If it is important, I'm using Processing 1.5.1 on a mac laptop, and I don't have the moviemaker option under Tools.



Here is the code:


import processing.video.*;
MovieMaker mm;


/////// MOVIE CODE

int numFrames = 12; 
PImage[] images = new PImage[numFrames];


void setup() {
  
  
size(1440, 900);
///////

mm = new MovieMaker(this,width,height,"NOZOOM_PUBLIC_MONEY_3.mov", 30, MovieMaker.JPEG, MovieMaker.HIGH);

///////
frameRate(4); 

    for (int i = 0; i < 12; i++) {
 
         
          String imageName = "A" + i +"_8.jpg";
      images[i] = loadImage(imageName);
         
       
}}

void draw() {




int frame = frameCount % 12;

    image(images[frame], 0, 0);


println(frame);



mm.addFrame();

}


 void keyPressed() {  //MOVIEMAKER
  if (key == ' ') {  //MOVIEMAKER
    // Finish the movie if space bar is pressed  //MOVIEMAKER
    mm.finish();  //MOVIEMAKER
    // Quit running the sketch once the file is written  //MOVIEMAKER
    exit();  //MOVIEMAKER
  }  //MOVIEMAKER
}  //MOVIEMAKER


Here is the error message:



quicktime.std.StdQTException[QTJava:7.7.1g],-5000=afpAccessDenied,QT.vers:7718000
at quicktime.std.StdQTException.checkError(StdQTException.java:40)
at quicktime.std.movies.Movie.createMovieFile(Movie.java:116)
at processing.video.MovieMaker.initMovie(MovieMaker.java:219)
at processing.video.MovieMaker.<init>(MovieMaker.java:209)
at processing.video.MovieMaker.<init>(MovieMaker.java:169)
at EXPORT_TRIAL_NOZOOM_PUBLIC_MONEY_3.setup(EXPORT_TRIAL_NOZOOM_PUBLIC_MONEY_3.java:39)
at processing.core.PApplet.handleDraw(PApplet.java:1608)
at processing.core.PApplet.run(PApplet.java:1530)
at java.lang.Thread.run(Thread.java:680)





Please and thank you for any help!

Replies(6)

" AccessDenied"
Perhaps move the file somewhere else: put an absolute path for the movie file, like /tmp/movie_name.mov
Yes, that worked. Thank you.

New question:

The exported file does not have the same playback speed. The frameRate in my sketch is 4, but the .mov file is WAY faster than that. Is this a fixable issue only in my movie editor, or is there a way to fix that in my Processing code?


Leave the frameRate to default (30), it should be close to the frame rate of a movie.
So, use a timer (millis()) to control the rate of display of your images, ie. update dtraw() only 4 times per second.
Hi again,
 
I've restructured my code so it uses millis() as a timer for my images when I export to .mov
 
My problem is that the output file is 0 bytes and not readable. What's going wrong?
 
 
 
 
//PUBLIC ROW A-D {all sets}


import processing.video.*;

MovieMaker mm;

 

int numFrames = 79;
PImage[] images = new PImage[numFrames];


// variables for display-timings
int frame =0;
int frameStart =0;
int displayTime = 500;

 

void setup() {
 
 
size(1400, 900);


///////

 


mm = new MovieMaker(this,width,height,"/Documents/lindermovie.mov", 30, MovieMaker.JPEG, MovieMaker.HIGH);

 


///////

 

 

 

    for (int i = 0; i <79; i++) {
     
      if (i < 8){
    
      String imageName = "E" + 1 + "_" + (i+1) + ".jpg";
      images[i] = loadImage(imageName);}
     
      if (i>=8 && i<16){
      

      String imageName = "E" + 2 + "_" + (i-7) + ".jpg";
      images[i] = loadImage(imageName);}
     
     
      if(i>=16 && i<24){
      
      String imageName = "E" + 3 + "_" + (i-15) + ".jpg";
      images[i] = loadImage(imageName);}
     
     
     
      if(i>=24 && i<32){
     
      String imageName = "E" + 4 + "_" + (i-23) + ".jpg";
      images[i] = loadImage(imageName);}
    
    
    
    
      if(i>=32 && i<40){
      
      String imageName = "E" + 5 + "_" + (i-31) + ".jpg";
      images[i] = loadImage(imageName);}

 

      if(i>=40 && i<48){
      
      String imageName = "E" + 6 + "_" + (i-39) + ".jpg";
      images[i] = loadImage(imageName);}
     
     
     
      ////////////ROW B//////////////////
     
     
      if (i>=48 && i<56){
    
      String imageName = "F" + 1 + "_" + (i-47) + ".jpg";
      images[i] = loadImage(imageName);}
     
      if (i>=56 && i<64){
      

      String imageName = "F" + 2 + "_" + (i-55) + ".jpg";
      images[i] = loadImage(imageName);}
     
     
      if(i>=64 && i<72){
      
      String imageName = "F" + 3 + "_" + (i-63) + ".jpg";
      images[i] = loadImage(imageName);}
     
     
     
      if(i>=72 && i<79){
     
      String imageName = "F" + 4 + "_" + (i-71) + ".jpg";
      images[i] = loadImage(imageName);}
    
    

     
     
     
     

 


}
}
 

 

 

 

 


void draw() {

 

 


if (frame <79){

    image(images[frame], 0, 0);

}

else{
  frame=0;
 
}
println(frame);


  // switch to next image, after 'displayTime'
  if (millis()-frameStart > displayTime) {
    frameStart = millis();
    frame++;
  }


}
  
  
     

 void keyPressed() {  //MOVIEMAKER

  if (key == ' ') {  //MOVIEMAKER

    // Finish the movie if space bar is pressed  //MOVIEMAKER

    mm.finish();  //MOVIEMAKER

    // Quit running the sketch once the file is written  //MOVIEMAKER

    exit();  //MOVIEMAKER

  }  //MOVIEMAKER

}  //MOVIEMAKER

 

 


   
 


 
 


 

It looks like you may have dropped the part where you write frames to the movie.

Try adding this back in after your if statement in draw():

mm.addFrame();

The idea is that you only want to clear and draw a new image after you have counted over your displayTime. Every other draw loop you still want to write a frame to the movie file.

I would also move your frame < 79 check right after the frame increment. like this:
Copy code
  1. void draw() {

  2.   // switch to next image, after 'displayTime'
  3.   if (millis()-frameStart > displayTime) {
  4.     frameStart = millis();
  5.     frame++;
  6.     if(frame > 79){
  7.       frame = 0;
  8.     }
  9.     
  10.     image(images[frame], 0, 0);
  11.     println(frame);
  12.   }
  13.      mm.addFrame();
  14. }


also, if you click the little page with <> icons (third from the right above the posting text field) then paste your code, it will add line numbers and make your code look like code :)

good luck!
ak
Thank. you. so. much. It works now. I'll remember that last tip for the next time I have a problem :)