Login | Register 
Products Applications Downloads Features Wiki forum Store
 

moviein end of loop detection

Helpful techniques for working with TouchDesigner. Answers only, no questions.

moviein end of loop detection

Postby michela » Sun Apr 15, 2012 8:12 am

What is the recommended way to detect the last frame of a moviein node has just played?

According to this post, there is an 'end signal' but I can't see this documented anywhere
viewtopic.php?f=27&t=2046&p=6789&hilit=moviein+end#p6789

I'm getting unpredictable results with code like this - sometimes it works, sometimes not. I Sometimes the index_fraction jumps to some number like this! 5.92e-006

Code: Select all
if `chop ("movie2_info/index_fraction")` > 0.99
#   echo "end of movie 2"
   opparm movie_fader value0 (2)
   rvar current_movie = 'movie3'
   opparm movie2 cue 1
   opparm movie3 cuepoint 0
   opparm movie3 cue 1
   opparm movie3 cue 0
endif


My use case is pretty simple - I just want to play a sequence of movieins one after the other as if they were on the same timeline, and then play with the logic once that's working... I'm starting out with Touch and want to understand how to control a set of movies accurately and missing something fundamental I think.

Thanks in advance

Michela
michela
 
Posts: 58
Joined: Tue Jan 10, 2012 10:51 pm
Location: Sydney

Re: moviein end of loop detection

Postby malcolm » Mon Apr 16, 2012 10:29 am

The issue that you are likely running into is if it skips over the 0.99-1.0 range. For example if process drops a frame right at that point you could go from 0.9899 -> 0.0, or even father into the process if it drops quite a few frames.

One way to do this is check if the index_fraction of the current frame is less than the index_fraction of the last time it showed a frame.
User avatar
malcolm
Staff
 
Posts: 2217
Joined: Tue Nov 13, 2007 12:11 am

Re: moviein end of loop detection

Postby michela » Mon Apr 30, 2012 11:15 pm

Thanks Malcolm. That is definitely more reliable but I still have the issue of the start of the loop being shown (as an occaisional flicker) before the code to move on is executed.

Isn't there any clean way of detecting moviein node has played beginning to end without having to loop?
michela
 
Posts: 58
Joined: Tue Jan 10, 2012 10:51 pm
Location: Sydney

Re: moviein end of loop detection

Postby ben » Tue May 15, 2012 1:45 pm

On the Trim parameter page you can set Extend Right to Hold and then the movie will not loop, it will just hold at the end frame making sure you get your end of movie signal.
User avatar
ben
Staff
 
Posts: 875
Joined: Thu Nov 08, 2007 5:55 pm
Location: Toronto

Re: moviein end of loop detection

Postby higa » Mon Jul 09, 2012 1:28 pm

just curious, will it be possible in future versions to get the movieIn to output a bang when it hits the end? or a 0/1 to signal if it's played all the way through.
higa
 
Posts: 28
Joined: Sat May 28, 2011 8:38 pm

Re: moviein end of loop detection

Postby higa » Mon Jul 09, 2012 1:45 pm

i guess i can use an info chop to pull the true_index and length, and compare them. and as long as i'm using a trim with an extend right hold it will catch it.

it gets a little tricky if it's looping though, the trigger doesn't always see it so i have set the catching variable to slightly before the end.

also, is there a built-in way to see how many times something has looped? or is the best way to just build a trigger into a count?
higa
 
Posts: 28
Joined: Sat May 28, 2011 8:38 pm

Re: moviein end of loop detection

Postby rodberry » Mon Jul 09, 2012 9:02 pm

It wouod be nice to have an example project up here showing the most efficient way to handle this, especially where you have different components having cooking on and off and loading and unloading of media in the context of a large interactive project that depends on video.

rod.
User avatar
rodberry
 
Posts: 908
Joined: Wed Nov 14, 2007 1:51 pm
Location: Hobart, Tasmania, Australia

Re: moviein end of loop detection

Postby rodberry » Mon Jul 16, 2012 3:46 am

Just revisiting this as I ran into this issue again.

In the attached example, the fractional index never quite makes it to 1.
Surely the end should equal 1 and stay there if it's really a fraction?

I still havent seen a totally trustworthy way of knowing that I'm at the end.

it would be great to have a watertight 0 or 1 value in the info chop called 'finished' or something like that.

Rod.
Attachments
movie_index.2.toe
(3.99 KiB) Downloaded 49 times
User avatar
rodberry
 
Posts: 908
Joined: Wed Nov 14, 2007 1:51 pm
Location: Hobart, Tasmania, Australia

Re: moviein end of loop detection

Postby greg » Sun Aug 26, 2012 12:59 am

Sorry there's still no clean way to do this in TD. In the very near future, we will put channels in the Info CHOP that report the detection!

In the meantime, attached are a few approaches. There are 2 cases: trigger when it loops, and trigger when it stops at end after it shows the last frame.

The solutions handle all cases of driving the movie: using the Movie Index, using the Play/Cue parameter method, and driving the movie by the timeline.

The key to the three solutions is that it needs to use the state of the movie index at the previous frame and the current frame. Hence the use of the Slope CHOP and the CHOP Execute DATs.

Anyway, goof around with it, read the README and see if it's any better.
Attachments
movieend_detect.tox
(3.88 KiB) Downloaded 56 times
User avatar
greg
Staff
 
Posts: 293
Joined: Tue Nov 13, 2007 12:08 am

Re: moviein end of loop detection

Postby malcolm » Fri Nov 09, 2012 12:08 pm

In the upcoming release of 088 there are two new Info CHOP channels for the Movie In TOP, 'last_frame' and 'loop_frame' which make this much easier to do.
User avatar
malcolm
Staff
 
Posts: 2217
Joined: Tue Nov 13, 2007 12:11 am

Next

Return to Techniques

Who is online

Users browsing this forum: No registered users and 1 guest

cron