A single sketch for saving video's frames and storing them in an array

I believe this is a beginner’s question :slight_smile:

I want to play a video in Processing for the purpose of storing the frames in a folder and then storing those frames in an array so I can upload them into the sketch for further manipulation.

The problem is that playing and saving the video’s frames happen inside draw(), whereas storing the frames in an array occurs inside setup() (I can’t store them in an array before breaking the video into consecutive frames).

Does anyone have an idea how I can combine them in a single sketch? Is that possible?

Thanks in advance!

Can you do it in two separate sketches? Create one sketch that processes the video into image files, and then another sketch that loads the image files.

If that won’t work, can you please post a MCVE that shows what you’re trying to do?

Thanks @Kevin, yes I currently have two separate sketches but I was wondering if it was possible in any way to combine them for the sake of efficiency…

You will get better feedback if you provide a demo aka MCVE of your code.

For instance, if you put it together, I assume you will run or the other but not both, correct?

Kf

I would probably just stick with two sketches. In fact that’s exactly what I did for my Movie Colors project.

I wouldn’t worry too much about “efficiency” with this kind of thing. Keeping your code simple and easy to work with is generally much more important.

If you really need to do it in one sketch, then you can do something like play the movie at 10x speed to get the frames at startup.

1 Like

Yes exactly @kfrajer

I see what you mean @Kevin, thanks!