Cache every frame of movie on load? Is it possible?

Hello Everyone,

I would now like to draw on the collective wisdom of TD users, with the hopes of gaining some help to find a solution to my current problem. Any help is sincerely appreciated.

Is there a way to have a movie be cached (by a Cache Top) for every single frame of the movie at the moment the movie is loaded in Touch?
Nonlinear caching?
If not for every frame, then how about select frames throughout the clip?

Here’s why:
I have a user interface which shows the entire length of the current movie clip (see attached image).
It is broken down into a series icons in the form of still frames from the entire length of the movie.
These still frames allow the user to make a more visually informed choice when selecting in/out trim points of the selected movie.

The problem: when the movie is dropped into TouchDesigner, it has to play once all the way through the entire clip (caching) before the preview stills can be generated.
With short clips it’s not a big deal, but with longer clips, it’s more of a problem.

Current unoptimized solution:
When a single movie is loaded into TD, 9 copies exact copies (lower rez) are automatically loaded as well. Each one of these movies is automatically trimmed to create a preview still for a different portion of the movie.
Movie1= frame 1, movie2= frame at 10%. movie3= frame at 20%…
Once the still is generated, a switch operation is performed, and the extra preview movies are bypassed.
So that creates the overall preview of the entire length of the clip, but then the preview for the cropped clip has to be generated as well, and update when in/out points are changed.
This solution works great, but it kills performance.

I realize that a cache-every-frame-on-load would slow the computer for a moment, but I could plan for that in my performance. I can’t plan around the continuous slowdown in the current unoptimized solution.

thanks!
jim

No in front of touch at the moment, but if the cache TOP has a prefill parameter,iI would try to set the movie in top to index mode, put $F in the index parameter, set your cache TOP to size == length of movie and finally set the cache top prefillparameter to 1.

You could do the same with a texture3d op in 2d mode …

And for select frames you can do a lookup table using $F as the lookup index

Achim, once again, thanks!

Your formula works perfectly.
I got one working with the Cache Top and CacheSelect Top.
I didn’t know about the Prefill option being able to force a Movie Top to preload.
Cool trick.
I can feel the hit to my performance (of course), but at least it’s brief.
System instability increases proportionately to moviesFiles/Cache sizes, which is to be expected. Crash.

I’m building a Texture3D top version now.
Visualization helps so much with the display on the Tex3D Top…
which is a top I sniffed around on while trying to solve this before. Maybe I should have sniffed harder.
Playing around with more optimizing parameters.
Also checking into your suggestion of a Lookup table.
I’ll report back.

Once again, thanks!
jim