Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

recording video on a mouse click

$
0
0

I'm trying to record a sequence from the camera, but only a part of images when the mouse is clicked. On a mouse click there is a sound, I want to save only images from the camera from the period when the sound is played. So far I can save all of the camera footage to the folder as frames, but i'd like to have only images which are happening on a mouse click only, to be saved. I'm stuck with the code below, and after many attempts to figure out what is wrong I feel like some help is needed.

Also, is it possible to record the video as explained above, but without actual camera footage showed in the window, so basically recording a spy camera, so the audience would not see the footage on the screen while the code is running?

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
import processing.sound.*;
import processing.video.*;
Minim minim;
AudioPlayer one; //variable name
Capture cam;

void setup(){
//println(Capture.list());
  size(640,360);

 cam = new Capture(this,640,360,30);
 cam.start();

  minim = new Minim(this);
  one =minim.loadFile("german.wav");


}

void draw(){

  //background(0);
 if (cam.available()) {
    cam.read();
if (mousePressed == true);
     saveFrame();
  }


image(cam,0,0);

}

void mousePressed(){
 //if (mousePressed == true);
  one.play();
  //  saveFrame();
}

void mouseReleased()
{
  if (mousePressed || true);
  one.close();
  one =minim.loadFile("german.wav");

}

Viewing all articles
Browse latest Browse all 2896

Trending Articles