mzdoherty
YaBB Newbies
Offline
Posts: 14
glitches in video
Jun 11th , 2007, 8:02pm
ok, so what i'm doing is masking video with a pgraphics shape using bitshifting. The mask is really glitchy with the video(its fine with images) and i've tried messing with framerate, compression, and size in both quicktime and processing. I'd rather not have to change into images sequences just because i have a lot of footaage and have had nightmares dealing with java overload and loading a lot of image sequences(even though this may have been resolved). I'm running mac os x 10.4.9 and processing 0124 You can download my sketch here: http://users.design.ucla.edu/~mdoherty/file/processing/video_bitshift.zip (936kb) my code is: import processing.video.*; Movie img; PGraphics pg; int r, g, b, a; void setup() { size(360,240); frameRate(30); img = new Movie(this, "grass.mov"); img.loop(); pg = createGraphics(360,240, JAVA2D); pg.smooth(); } void draw(){ background(0); pg.beginDraw(); pg.noStroke(); background(0); pg.fill(255); pg.ellipse(mouseX, mouseY, 40,40); pg.modified = true; pg.endDraw(); img.loadPixels(); pg.loadPixels(); for (int i = 0; i < img.pixels.length; i++) { a = (img.pixels[i] & 0xff000000) >> 24; r = (img.pixels[i] & 0x00ff0000) >> 16; g = (img.pixels[i] & 0x0000ff00) >> 8; b = (img.pixels[i] & 0x000000ff) >> 0; //do some math with r,g,b & a a = (pg.pixels[i] & 0x00ff0000) >> 16; img.pixels[i] = (a << 24) | (r << 16) | (g << 8) | b; } pg.updatePixels(); img.updatePixels(); image(img,0,0); } void movieEvent(Movie m) { m.read(); }