Copy from source to PGraphics

Hello,
I am working on a simple visualization from the slitscan process. I try to copy from an movie input into an PGraphics buffer. When I try it I get the following error when I try to copy in draw.

Width (0) and height (0) cannot be <= 0

Do you know how this happens?

Code

import processing.video.*;
PGraphics pg_draw;
PGraphics pg_video;
Movie Input;

int slice = 20;
int xpos = 1920/2;
PImage img;

void setup() {
  img = loadImage("014.png");
  size(1920, 1080);

  pg_draw = createGraphics(width/2, height);
  pg_video = createGraphics(width/2, height);
  Input = new Movie(this, "CBIR.mov");
  Input.play();
  Input.speed(100);
  Input.volume(0);
  background(0);
}

void draw(){
  if(Input.available()){
    Input.read();
  }
  
  //Video Buffer
  pg_video.beginDraw();
  pg_video.image(Input,0,0);
  pg_video.endDraw();
  
  //Slitscan Buffer
  pg_draw.beginDraw();
  int w = Input.width;
  int h = Input.height;
  copy(Input, w/2, 0, slice, h, pg_draw.width/2, 0, slice, h);
  pg_draw.endDraw();
  
  image(pg_video, 0, 0);
  image(pg_draw, width/2, 0);
  if (Input.time() == Input.duration()) { //movie must be finished
    exit();
  }

Your code runs on my machine. Of course, I don’t have the same video file.
If the video is taking a moment to load, you might try moving the copying code into the “if available” block.

hey thanks. It was odd, I simply rewrote the code in an another fashion and now it is working. I also do not know where the problem was.