Problem with slitscan effect for pre-recorded video

Hello everyone

I am trying do slitscan effects, but instead of sourcing the feed from a webcam i want to apply the effect on pre-recorded video.

I run into some problems with the copy command.
I can load the sketch, but no image, only sound.

The code i am running is in this link: https://bit.ly/2QA4k8l

These are the errors i encounter.
No image in the sketch when i run it.
And the error message displayed in the bottom right.

Any ideas on how to solve this? Thanks!

  • The video library takes some time to “ignite” after we issue a “play” command.
  • Until then, its width & height dimensions are still 0!
  • As a workaround, we can delay() inside setup() until the video is fully ready.
  • This way, when draw() is called back for the 1st time, we’re safe to access the video.
void setup() {
  // ...

  ( myMovie = new Movie(this, "kat.mov") ).loop();
  while (myMovie.height == 0) delay(2);
}

Works perfectly! mega cool!

Thanks for a fast and precise answer - perfect!

Wow, that’s … horrible! And might break things, particularly if you change renderer.

OTOH, you could always put

if (myMovie.width < 1) {
  return;
}

at the beginning of draw()

1 Like

Ah okay - thanks alot for more options

I will check out this solution also!