We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am creating an interactive 360 video sketch (with the help of this shader ) where a user will be able to speed and slow the clip (to make it look like they are moving through the scene) and look side to side by moving the mouse in the y and x directions, respectively. My goal is to display this sketch across three monitors so I would like to use high resolution video, however the sketch's performance worsens as the video quality increases and playback is often shaky. The shader seems to have very high performance but pausing and playing at different speeds sometimes makes the video jump or shake. I'm looking for solutions to make the video more smooth and be able to display it on a large area. I have allotted 1 gigabyte of memory to Processing through Preferences and I don't know if allotting more would solve my problem? Perhaps I just need a more powerful computer ( currently on 64-bit Windows, 4GB RAM)? I have looked into pre-loaded the whole video but haven't found anything promising.
Below is my code, any help is appreciated!
import processing.video.*;
float joystick_yaw, joystick_speed;
Movie movie;
PShader shader;
float yaw, pitch, fov;
boolean isPaused = false;
void setup() {
size(1280, 720, P2D);
// pitch and yaw set to start video in desired view
yaw = 225;
pitch = 5;
fov = 80;
shader = loadShader("data/video360.glsl");
shader.set("resolution", float(width/2), float(height/2));
shader.set("yaw", yaw);
shader.set("pitch", pitch);
shader.set("fov", fov);
movie = new Movie(this, "stitch_high.mp4");
movie.play();
movie.volume(0);
while (movie.height == 0) {
println("waiting " + second());
delay(10);
}
imageMode(CORNERS);
}
void draw() {
// display video
shader(shader);
image(movie, 0, 0, width, height);
// display yaw
joystick_yaw = map(mouseX, 0, 1200, yaw-(fov/3), yaw+(fov/3));
shader.set("yaw", joystick_yaw);
//choose speed of video
joystick_speed = map(mouseY, 0, height, 2, -2);
if (joystick_speed > 0.2 && isPaused ) {
movie.speed(joystick_speed);
movie.play();
movie.speed(joystick_speed);
isPaused = false;
} else if (joystick_speed < -0.2 && isPaused) {
movie.speed(joystick_speed);
movie.play();
movie.speed(joystick_speed);
isPaused = false;
} else if (joystick_speed >= -0.2 && joystick_speed <= 0.2) {
if (!isPaused) {
movie.pause();
isPaused = true;
}
}
}
// Called every time a new frame is available to read
void movieEvent(Movie m) {
m.read();
}