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
Introducing a video delay (Read 984 times)
Introducing a video delay
Aug 30th, 2005, 4:15am
 
Hello all,

This is my first Processing project, but basically I will have a video soruce, (a feed from either a DV Deck or a Camera) and I need to put a delay of X seconds into it, then have the computer "Play" the video via another firewire connection to a different DV deck (or possibly just the screen)


Could someone point me in the right direction?


Thanks!
-Spencer
Re: Introducing a video delay
Reply #1 - Aug 30th, 2005, 11:57pm
 
Your maximum effective capture for a DV signal is around 640 * 480. So you'll need a PImage[] array to hold the number of frames equivalent to framerate and delay

i.e:

Code:

int framerate = 1; //per sec
int delay = 10; // secs
PImage[] videoBuffer;
boolean buffFull = false;
int bufIndex;

void setup() {

videoBuffer = new PImage[framerate*delay];

for (int i=0; i<videoBuffer.length; i++) {

videoBuffer[i] = new PImage(captureWidth, captureHeight);
}
}

void draw() {

}


void captureEvent() {

if (buffFull) { // this flag waits for the buffer to become full

//send pimage to output, or set flag and do it in draw if you prefer
}

//fill this buffer position with current video image

if(bufIndex++ >= videoBuffer.length) {
 buffFull = true;
 bufIndex = 0;
}

}



This'll provide you with an array of images, so a new capture Event gets copied into videoBuffer[index]

when the buffer is full: 1st buffer frame is sent to output and then replaced by new video capture, and then update the pointer.

Should be pretty straightforward.

Your basically populating and array of pimages with frames from a source and then when the buffer is full you start sending them out 1st to last and you can just keep wrapping the pointers round and around, filling each slot with a new image after its been output.


Sorry about the incomplete code, but I'm typing this blind and am not testing. Method names may need to be checked in reference section etc.

Page Index Toggle Pages: 1