# Problem with slitscan effect for pre-recorded video

**URL:** <https://discourse.processing.org/t/problem-with-slitscan-effect-for-pre-recorded-video/5456>\
**Category:** Libraries\
**Created:** [November 11, 2018, 7:49pm UTC](https://discourse.processing.org/t/problem-with-slitscan-effect-for-pre-recorded-video/5456 "2018-11-11T19:49:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![KarlKlimpe](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@KarlKlimpe](https://discourse.processing.org/u/KarlKlimpe)\
**Post date:** [November 11, 2018, 7:49pm UTC](https://discourse.processing.org/t/problem-with-slitscan-effect-for-pre-recorded-video/5456/1 "2018-11-11T19:49:15Z")

</div>

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](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!

 ![Capture2](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/dee83b6d0a6dfdc149b2f6f77de1d6624975eca5.jpeg)

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 11, 2018, 10:35pm UTC](https://discourse.processing.org/t/problem-with-slitscan-effect-for-pre-recorded-video/5456/2 "2018-11-11T22:35:42Z")

</div>

- 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.

```java
void setup() {
  // ...

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

```

---

<div class="post-metadata">

**Author:** ![KarlKlimpe](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@KarlKlimpe](https://discourse.processing.org/u/KarlKlimpe)\
**Post date:** [November 11, 2018, 10:52pm UTC](https://discourse.processing.org/t/problem-with-slitscan-effect-for-pre-recorded-video/5456/3 "2018-11-11T22:52:09Z")

</div>

Works perfectly! mega cool!

Thanks for a fast and precise answer - perfect!

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [November 11, 2018, 11:00pm UTC](https://discourse.processing.org/t/problem-with-slitscan-effect-for-pre-recorded-video/5456/4 "2018-11-11T23:00:50Z")

</div>

> [@GoToLoop](#):
>
> As a workaround, we can **delay()** inside **setup()** until the video is fully ready.

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

OTOH, you could always put

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

```

at the beginning of draw()

---

<div class="post-metadata">

**Author:** ![KarlKlimpe](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@KarlKlimpe](https://discourse.processing.org/u/KarlKlimpe)\
**Post date:** [November 11, 2018, 11:04pm UTC](https://discourse.processing.org/t/problem-with-slitscan-effect-for-pre-recorded-video/5456/5 "2018-11-11T23:04:08Z")

</div>

Ah okay - thanks alot for more options

I will check out this solution also!
