We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Internal video/window capture? (Read 605 times)
Internal video/window capture?
Sep 12th, 2008, 4:46am
 
Hello everyone,
   I am starting to get acquainted with processing and am having a blast as a beginning programmer integrating this medium into my artistic pursuits.  I have been studying video feedback with webcams and projectors via splicing camera pixels with generated pixels in my sketches.  The results have been pretty interesting, though with a home brewed look. Now, it seems time for a more robust and integrated method.
  I have been wondering about the issue of video capture, but more specifically about 'piping' the sketch window internally to another program (a video mixer like modul8), for full screen display of the composite image to another display.  I am just wondering if anyone out there has delved into such things and has any suggestions.
  In brainstorming I have thought of a few options. The primary goal is to keep it on one computer. I realize the simplest and most costly solution would be to send a full screen sketch to a USB capture device and then to another computer.  Or perhaps there is some way to pump it out and back into the same computer.  This thought leads to the next.
   What sort of methods are there for sending the frames of the sketch window to another application?  I gather you could somehow send each frame to another program that could then encode them as a video input, perhaps using openGl to accelerate things.  In scouring around I haven't been able to find any software that would do this 'out of the box'.  
  Does anyone have any thoughts on software that could achieve this or ways to hack together a combination of processing and something else?  Of course, this kind of thing sounds like it may be pretty intensive on the system, so GPU acceleration seems like a must.
   I hope my description is focused enough, please let me know if you have any questions or ideas, I greatly appreciate it.  Processing is quickly becoming a key part of the arsenal and there is so much precedent and inspiration to pull from out there!  Cheers
-archo_p
 
Re: Internal video/window capture?
Reply #1 - Sep 13th, 2008, 6:34pm
 
You can achieve feedback on one computer if you have a tuner card and a graphics card with a video out.

Connect the video out of your graphics card to the in on the tuner card then play the stream from the tuner card full-screen. Uhh, I think thats how it went. I had it set up once but never did to much with it.

I also just got some feedback working in a single sketch. I feed the pixels of the main PGraphics dealie to a PImg every frame and map the image onto a quad, with some rotation, that fills the sketch. So, main pixels array to quad and back to pixels array. I'll post it on my blog when I get on my regular computer.
Re: Internal video/window capture?
Reply #2 - Sep 15th, 2008, 1:38am
 
Rick

Thanks for the tip!
Yeah I figured you could create some sort of hardware feedback loop, but would that enable you to send the contents of the sketch as if it were 'fullscreen' and still be able to do other manipulations in another program?  Is there a way you can pipe the frames of the window to the graphics out without obscuring your ability to do control processing or other programs?  I assume you could make the output to the tuner a second display, but then you've lost your ability to display the composite image to another display ( unless you have more than two display outputs, I am working with a Mac Book Pro, so only one other display out).

Perhaps there is a way you can code the sketch so that it  writes images that can then be accessed by something else?  It sounds a bit clunky, and I wonder if there is a way to keep it all in the memory buffers of the GPU or something.  I'm not vary familiar with how that sort of thing would work.  One of my other interests is just being able to use a generated animation as one piece of a larger 'video mix', VJ style I suppose.  It just seems like there should be a way to transfer the frames of the sketch directly to the video capture input of another program, but maybe its wishful thinking!

Anyways, just brainstorming.  Anyone else have thoughts?  Happy coding!
Re: Internal video/window capture?
Reply #3 - Sep 15th, 2008, 5:25pm
 
You want to have a control interface but keep it out of the main display loop? That is tough. Maybe if you can get a third display you could control it on that one. Loop through the native display to the tuner output and then put your controls on another physical display.

Here is the code I was referring to in my earlier post although it may be not exactly what you wanted its still kind of on topic.

Quote:


PImage cp;
int r = (int)random(255);
int g = (int)random(255);
int b = (int)random(255);

void setup() {
 size(400,400,P3D);
 background(196);
 loadPixels();
 cp = createGraphics(width, height, P3D);
 cp.loadPixels();
 arraycopy(pixels, cp.pixels);
 cp.updatePixels();
}

void draw() {
 r++;
 g++;
 b++;
 stroke(color(r%255, g%255, b%255));
 noFill();
 ellipse(mouseX, mouseY, 50, 50);
 arraycopy(pixels, cp.pixels);
 cp.updatePixels();  
 //background(196);
 translate(width/2, height/2);
 rotateZ(map(mouseX, 0, width, -TWO_PI, TWO_PI));
 rotateX(.01);
 noStroke();
 fill(1);  
 beginShape(QUADS);
 texture(cp);
 vertex(-width*.68, -height*.68, 0, 0);
 vertex(width*.68, -height*.68, width, 0);
 vertex(width*.68, height*.68, width, height);  
 vertex(-width*.68, height*.68, 0, height);
 endShape();
}


Page Index Toggle Pages: 1