I did a lot of code dabbling on this video capture tutorial sometime around 2017 : https://www.youtube.com/watch?v=rNqaw8LT2ZU using p5js version v0.5.11 . All seem to work even around early 2018 but when i revisited my code now, video.loadPixels() does not seem to work. Updated p5js library to version v0.7.2 but still no go.
Anyone having similar experience / workaround ?
Looks like it’s a know bug in v0.7.2. If you’d like to use
loadPixels() on a video I think the easiest thing is just to switch back to v0.7.1 and wait for v0.8.0 where it’ll probably be fixed.
Hi Rjsan, I faced the same problem yesterday. But I was working on Processing P3 with this Code from the video in link. Luckily, I have fixed it
I was facing error in the “loc” variable in this command, video.loadPixels(loc). The error was “arrayindexoutofboundsexception: 307200”
If you are facing the same do the following:
int loc = x + y * video.width; ………………….(1)
color currentColor = video.pixels[loc];…………(2)
you must know and confirm that code(1) is accurately entered as it is written here. If it is correct, then you will not get the “arrayindexoutofboundsexception: 307200” error.
640 = width i.e. “x=639 maximum” [because bits start from 0]
480 = height i.e. “y=479 maximum” [because bits start from 0]
loc = x + y * video.width;
loc = 639 + (479 * 640)
We get the “arrayindexoutofboundsexception: 123…” error, if our loc value is greater then the Max. calculated value of loc. It is may be only due to
1) Wrong equation Entered. [this equation must be same as code(1)]
Thanks figraham/Hassan , appreciate the input. Will look more into this.