Loading...
Logo
Processing Forum
This is based on the slit-scan example from Form+Code

I have 2 problems; the program quits on me before it reaches the end due to this error,
which I can't figure out how to debug:

java(9270,0xac90e2c0) malloc: *** error for object 0x11542c0: double free
*** set a breakpoint in malloc_error_break to debug

and would there be any clever way of actually outputting a very wide file
of the entire process, without having a window-size of say 8000 pixels?

Copy code
  1. import processing.video.*;

  2. Movie myVideo;

  3. int video_width     = 300;
  4. int video_height    = 400;
  5. int video_slice_x;

  6. // length of output file
  7. int window_width    = 8000;
  8. int window_height   = video_height;
  9. int draw_position_x = 0; 
  10. boolean newFrame  = false;

  11. int lastTimeCheck;
  12. int timeIntervalFlag = 2500; 


  13. void setup() {
  14.   myVideo = new Movie(this, "test.mov");
  15.   size(window_width, window_height, P2D);
  16.   background(0);
  17.   myVideo.loop();
  18.     lastTimeCheck = millis();
  19. }

  20. void movieEvent(Movie myMovie) {
  21.   myMovie.read();
  22.   newFrame = true;
  23. }

  24. void draw() {
  25.   if (newFrame) {
  26.  
  27.     loadPixels();
  28.     for (int y=0; y<window_height; y++){
  29.      
  30.       if ( millis() > lastTimeCheck + timeIntervalFlag ) {
  31.             lastTimeCheck = millis();
  32.             video_slice_x = int(random(60,255));
  33.             
  34.           }
  35.           
  36.       int setPixelIndex = y*window_width + draw_position_x;
  37.       int getPixelIndex = y*video_width  + video_slice_x;
  38.       pixels[setPixelIndex] = myVideo.pixels[getPixelIndex];
  39.    
  40.     }
  41.     updatePixels();
  42.          
  43.     
  44.     draw_position_x++;
  45.     
  46.     if (draw_position_x >= window_width) {
  47.     // saveFrame when it reaches the desired length
  48.       saveFrame("line-####.tif"); 
  49.      exit();
  50.     }
  51.     newFrame = false;
  52.   }
  53. }



Replies(3)

not sure why this is happening. it could just be a bug in the video library.

you could try to add load and updatePixels also for myVideo - i.e. like this

Copy code
  1. loadPixels(); //this is implicitly operating on the current rendered image and is equivalent to this.loadPixels();
  2. myVideo.loadPixels();
  3. //... code manipulating pixels...
  4. myVideo.updatePixels();
  5. updatePixels();
Thanks, but doesn't seem to fix it.
try a different video capture library? are you using processing 2?