Video Playback Duration Switching Video

Hi,
I have a video that has been edited together and want to switch the video order via “switch top” based on the video duration. At the 101st second, I hope the index of “switch top” increases to 1. At the 209th second, I hope the index of “switch top” increases to 2. How can this be achieved? Thanks.

Off the top of my head:
info CHOP to extract the timecode from the movie file in TOP = minutes & seconds, then use math CHOPs to calculate total seconds.
After that I would probably use a couple of logic CHOPs = ‘Off When Outside Bound’, with the bounds set to the required values…then maybe a looped or clamped count CHOP feeding the switch TOP

I’m sure there are other methods and perhaps I’m missing something, but I believe that should get you started.

1 Like

Hello,
More easely editable (even with a table containg values)

  • chop execute Dat based on index_fraction:
def onValueChange(channel, sampleIndex, val, prev):
	length = op('info1')['length']
	sample_rate = op('info1')['sample_rate']
	duration = length / sample_rate
	time = duration * val
	op('table1')[0,0] = time
	if time >= 0:
		op('switch1').par.index = 0
	if time > 1.2:
		op('switch1').par.index = 1
	if time > 2.4:
		op('switch1').par.index = 2
	return

time_switch.toe (3.9 KB)

1 Like

this is really helpful, thanks for the sample file

After days of searching, finally a working example. It worked.