Forum

VL - pause loop to wait for execution

vl

#1

hi all,

I want to create thumbnails of a video folder, but I am not shure how to approach this…
Using a loop and pausing it while processing is what I did in VVVV.
Or do I create objects that have the conversion functionality already implemented, generate them in a control patch… have them delete themselves after finishing?

This would also be a opportunity for async regions, so multiple instances of ffmpeg could run at the same time.

Any tipps appreciated

Unbenannt


#2

put the entire patch into an AsyncTask region, then you won’t even stress the mainloop…


#3

yes that works, but it still opens too many ffmpeg instances at the same time.
I fixed it by having the thread sleep for some ms, but is there a way to wait for the executioner to finish - and then allow the loop to go to the next iteration?


#4

you’d first have to define what exactly you want. i can think of these options:

  • process one after the other, blocking
  • process one after the other, async
  • process a couple in parallel, async
  • process all of them in parallel, async

#5

a couple in parallel, async


#6

you chose the probably most complex. in this case i’d say yes, this would be an option:

ie. thinking it once again like a particle system. each particle would be converting one file using an Executor inside an asynctask) and die when it is finished. the particle system has a max-amount of active particles that you decide and whenever a particle dies a slot is freed for a new particle…


#7

I see, and what about “process one after the other, async”?

atm I would solve this with a counter that iterates when executioner sends “finished”, but is there a slick way to use the regions for this?


#8

this should work out of the box as you did initially (AsyncTask around foreach), when the Executor gets a blocking option. if you need it right now, you can easily make a local copy of the Executor and add a Process.WaitForExit().

otherwise watch this space for an update, when i added it and new alpha is up…


#9

there is nothing holding you back putting an AsyncTask region into a ForEach region in another AsyncTask.

to have a nicer patch structure i would make a Process that deals with the inner stuff (AsycTask in ForEach) and then put that process node into the outer AsyncTask and link the file list into it.

never tried it, but might work.


#10

latest alphas now have “Time to Wait for Exit” input on Executor. by setting this value high (up to maxint) you can essentially have the operation blocking.