movie switch , play and stop

Hi ,

I am sorry if there are already posts about this subject but I cannot find a solution to my problem.

I am a TD beginner and am currently working on an interactive installation using video, sound and webcam feed.

The video switch index data comes from a LFO - count association.
The switch works well between the videos.

My problem is that all the videos are playing all the time in their respective movie file in TOP. My frame rate is pretty low and I think it might be the problem as all the videos are always cooked and the CPU cook time is high ( even 50 sometimes).

How can I stop the videos when their indexes is not the one currently playing by the switch ?

Please consider I am also new to Pyhton :wink:

thanks a lot ! Have a great day

Julie

touch designer is a pull-based system. A common misconception with cooking in TouchDesigner is that cooking starts upstream and moves downstream. But “Pull-based” means only the nodes cook which are connected to a node further down the line which needs its output, or if you are watching the output of this node.
The Order Of Cooking:
derivative.ca/wiki088/index. … of_Cooking
What Causes Cooking:
derivative.ca/wiki088/index. … es_Cooking

So if you use a Switch TOP which switches between 2 video inputs, only the one Movie IN TOP cooks which is connected by the Switch Top to your output node. (unless you are watching the live output of each Movie In Top in edit mode)

So try switching to perform mode, and see if your framerate goes up. And if you are in Edit mode, you can switch off the Display flags of each Movie in TOP (so you are not looking at output of those nodes, so they don’t cook). You can see animated lines between the nodes that cook.

Besides this, also try using the HAP codec for your movie files, which is very light for your CPU and is mainly decoded by your GPU.
derivative.ca/wiki088/index.php?title=Hap

thanks

Hi Julie,

By no means am I an expert, and I learned a lot from the post above, but you mentioned you were new at python so here is an example I created for you. It may not be the most elegant or best solution, but hopefully the concept of it can help you see how python works.

Basically the method I used is, the moviefilein TOPs check to see if the switch’s index matches their digits. If it does, it will play.

1 if op('switch1').par.index == me.digits else 0

movieswitchexample.toe (5.2 KB)

@organictech

Hi there, I came upon this thread because I am trying to solve a similar issue, while using a switch to pick video inputs. @organictech, the reply you posted is very helpful, however, the videos seem to ‘pause’ when not being played. Is there a simple way to have the videos begin from the start, everytime they are initiated?

I have been fiddling with the parameters but have not discovered how to do this yet.

Thanks a lot!

  • Jacob

Hi Jacob,

One way to do this is to use a parameter execute DAT. When the index of the switch changes it will run a script to reset the appropriate moviefilein TOP. make sure cue point is set to 0 (or wherever you want it to start from), and that the switch indices and moviefilein TOPs match up.

Take a look at the DAT in the attached TOX, if you’re not familiar with Python, it’s a very simple example.
start_mov_at_beginning.tox (766 Bytes)

This works except that you get one frame after the switch and before the pulse.

The way to solve this is to go upstream to the LFO using a “chop exec” DAT and set the switch index par after you have prepared the ‘movie file in’ TOP.

start_mov_at_beginning-fix.tox (774 Bytes)

also, i think the point that “nettoyeur” was trying to make is that touch needs to SEE the video to cook it.
If you notice, in my example, the viewers on the “moviefilein” TOP’s are turned off, this means touch will not cook it unless the switch needs to SEE it. if you turn off all the viewers, nothing will cook, even if the switch is specified.

If your computer is running slow in a specific network, first thing I do is select all, and hit ‘d’ this turns off all the display flags making a lot of extra things stop cooking that may not have needed to be. You may need to do this with some CHOPS or DAT’s that are way too long to be displayed.