get problem with video
in
Contributed Library Questions
•
1 year ago
This overlapping part to write their own movie, but I do not know what went wrong, strange
import processing.opengl. *;
import codeanticode.glgraphics. *;
import codeanticode.gsvideo. *;
GSMovie mov, yomov;
GLTexture tex;
int fcount, lastm;
float frate;
int fint = 3;
void setup () {
size (500, 500, GLConstants.GLGRAPHICS, P2D);
frameRate (90);
mov = new GSMovie (this, "01_black_2.mov");
yomov = new GSMovie (this, "02_color_2.mov");
tex = new GLTexture (this);
mov.setPixelDest (tex);
yomov.setPixelDest (tex);
tex.setPixelBufferSize (50);
tex.delPixelsWhenBufferFull (false);
mov.loop ();
yomov.loop ();
background (0);
noStroke ();
}
void draw () {
if (mov.available ()) {
mov.read ();
yomov.read ();
if (tex.putPixelsIntoTexture ()) {
float h = width * tex.height / tex.width;
float b = 0.5 * (height - h);
image (tex, 0, b, width, h);
fcount + = 1;
int m = millis ();
if (m - lastm> 1000 * fint) {
frate = float (fcount) / fint;
fcount = 0;
lastm = m;
}
}
}
}
The Rewind part want to use inducements to move the mouse around to control the execution of the beginning, has been play
, When the the left of the mouse, the video will jump forward one second and then began to pour broadcast (example: 10 becomes 9 then start 8.7.6.5.4 .... seconds)
When the mouse is shifted to the right, the movie will jump back one second and then began being broadcast (for example: 10 becomes 11 and then began 12.13.14.15 ... seconds)
It is at this stage, I do not know what went wrong the modification or the added Which syntax ...
import java.awt.Robot;
import java.awt.event. *;
import processing.opengl. *;
import codeanticode.glgraphics. *;
import codeanticode.gsvideo. *;
int Value;
int whee = 0;
int fcount, lastm;
float frate;
int fint = 3;
PImage imgmov;
boolean speedSet = false;
boolean LeftorRight;
GSMovie mymov;
GLTexture tex;
Robot rbt;
void setup () {
size (1920,1080, GLConstants.GLGRAPHICS, P2D);
background (0);
mymov = new GSMovie (this, "station.mov");
mymov.play ();
tex = new GLTexture (this);
mymov.loop ();
noStroke ();
imgmov = createImage (mymov.width, mymov.height, ARGB);
try {
rbt = new Robot ();
} Catch (Exception e) {}
}
void movieEvent (GSMovie mymov) {
mymov.read ();
}
float newFrame = 0.0;
float movlength = 0.0;
int st = 0;
void draw () {
Value = mouseX;
print (mouseX + "/" + mouseY + "\ n");
if (Value> 1500 | | Value <500) {
rbt.mouseMove (width / 2,150);
mymov.play ();
}
if ((mouseX-pmouseX> 10 && mouseX-pmouseX <50) | | st == 1) {
print ("R" + "\ n");
st = 1;
newFrame = newFrame + 0.1;
if (newFrame> mymov.duration ()) {
newFrame = 0.0;
}
mymov.play ();
mymov.jump (newFrame);
/ / Mov.pause ();
mymov.read ();
mymov.updatePixels ();
LeftorRight = true;
} Else if (mouseX-pmouseX <-10 && mouseX-pmouseX> -50) {
print ("left" + "\ n");
newFrame = newFrame - 0.1;
if (newFrame <0) {
newFrame = mymov.duration ();
mymov.jump (newFrame);
}
mymov.play ();
speedSet = true;
mymov.goToEnd ();
mymov.speed (-1.0);
mymov.read ();
mymov.updatePixels ();
LeftorRight = false;
} Else {
mymov.play ();
mymov.read ();
mymov.updatePixels ();
print ("stop" + "\ n");
}
image (mymov, 0, 0, width, height);
if (tex.putPixelsIntoTexture ()) {
}
print ("\ n");
}
1