As I said, I can't really help you with video issues, since I can't even get video working in my sketches. Try asking for help in the video forum. What I can do is give some insight into what my own code is doing.
// First we start the draw function
void draw(){
// Define two variables to describe how big the flashlight is.
float solidRadius = 20.0; // radius of solid circle.
float radius = 30.0; // radius of the fading circle.
// load up the next frames from each of the videos.
movie1.read();
movie2.read();
// if we need to load the pixels of the first video so we can access the pixels[] array of movie1, do so.
// movie1.loadPixels();
// draw the image of the second video to the screen.
image(movie2, 0,0);
// load the pixels[] array for what draw() will currently put on the screen if it were to stop right now.
loadPixels();
// loop about a small square of pixels near the mouse pointer
for (int x = mouseX-int(radius); x <= mouseX+int(radius); x++ ) {
for (int y = mouseY-int(radius); y <= mouseY+int(radius); y++ ) {
// if the pixel isn't even on the screen, go on to the next pixel.
if( y < 0 || y >= height || x < 0 || x >= width ){
continue;
}
// determine where in the pixel[] array this pixel is.
int loc = x + y*width;
// Get the color of the pixel in movie1 at this pixel's location.
color val = movie1.get(x,y);
// color val = movie1.pixels[loc];
// Find out how far away from the mouse cursor this pixel is.
float distance = dist(x,y,mouseX,mouseY);
// use the distance from the mouse cursor to determine how transparent the pixel from movie1 should be.
float transparency = map(radius-(distance-solidRadius), solidRadius, radius, 0.0, 255.0);
// using this transparency and the color of the pixel in movie1 at this location, create a new color
color c = color(red(val), green(val), blue(val), transparency );
// If this location is close enough to the mouse to be inside the flashlight area, blend the color we just generated with the pixel we drew with the line "image(movie2,0,0)", storing the result back into the array of pixels at this location.
pixels[loc] = distance<radius?blendColor(pixels[loc],c,BLEND):pixels[loc];
// If this location is close enough to the mouse to be inside the very center of the flashlight area, overwrite whatever was already in the pixels[] array with movie1's color at this pixel's location.
pixels[loc] = distance<solidRadius?val:pixels[loc];
// end the for loops for each pixel in the small square.
}
}
// use the finished pixel[] array!
updatePixels();
// End draw()
}
I also may have an idea as to why you're getting invalid memory access errors. It might be because you just assume that the next frame of the movies are ready to go every time draw() is called. This may not be the case. Look at the second example here:
http://processing.org/reference/libraries/video/movieEvent_.html