Mirror and reflect left side movie to the right side

Hi, I have to reflect and mirror the half of the left video with the right one. I tried this code but when I activate the effect the video shows only the first frame and does not play. How can I play the video with the effect? thanks!

import processing.video.*;
boolean flipVideo = false;
Movie movie;

PGraphics flippedBuffer; // PGraphics buffer for the flipped video
PImage leftHalf;

void setup() {
  size(640, 480);
  frameRate(30);
  
  movie = new Movie(this, "movie.mov");
 
  movie.loop();
  movie.read();
 

  flippedBuffer = createGraphics(movie.width, movie.height); // Initialize the buffer
}

void draw() {
  if (movie.available() && overlay.available()) {
    movie.read(); 
  }

  movie.loadPixels();
  

  // Create the flipped video and store it in the PGraphics buffer
 if (flipVideo) {
   flippedBuffer.beginDraw();

 leftHalf = get(0, 0, width/2, height);
  flippedBuffer.translate(width, 0);
  flippedBuffer.scale(-1, 1);
  flippedBuffer.image(leftHalf, 0, 0);
  
  flippedBuffer.endDraw();
  } else {
    flippedBuffer.beginDraw();
    flippedBuffer.image(movie, 0, 0); // Use the original video
    flippedBuffer.endDraw();
  }
}

void movieEvent(Movie m) {
  m.read();
}

void addTuioObject(TuioObject tobj) {
...
}

void removeTuioObject(TuioObject tobj) {
 ...
}

Hi @fatma90,

just a quick example. PGraphics is used here to keep it independent from sketch size.
Hope that helps …

Cheers
— mnse

import processing.video.*;

Movie movie;
PGraphics mg;

void setup() {
  size(600, 600);
  background(0);
  movie = new Movie(this, "launch2.mp4");
  movie.loop();
  movie.read();
  mg = createGraphics(movie.width,movie.height);  
}

void draw() {
  if (movie.available()) {
    movie.read();
    PImage halfimg = movie.get(0,0,movie.width/2,movie.height);
    mg.beginDraw();
    mg.translate(mg.width/2,mg.height/2);
    mg.image(halfimg,-mg.width/2,-mg.height/2,mg.width/2,mg.height);
    mg.scale(-1,1);
    mg.image(halfimg,-mg.width/2,-mg.height/2,mg.width/2,mg.height);    
    mg.endDraw();    
  }
  image(mg, 0, 0, mg.width, mg.height);
}