moviein end of loop detection

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]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[/code]

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

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.

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?

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.

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.

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?

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.

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.
movie_index.2.toe (3.99 KB)

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.
movieend_detect.tox (3.88 KB)

1 Like

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.

1 Like

Hooray! I had still been using an index cheat where i added 50-100 frames of black at the end of my quicktimes and checked to see if the true_index had run over the length minus 50 (i found when i just compared the index to length, it would “skip” over noticing it had hit the end one out of every five times or so)

Have modified my code now so my MovieIn TOPs use Trim and Extend Right Black.

Then have an info chop > select chop for ‘last_frame’ which triggers an Off to On CHOP Execute DAT.

was running into problems until i realized i had to reload the clip as well, so now on the turn_off CHOP Execute DAT i have

opparm movTexture play 0
opparm movTexture reload 0

and then when the movie is triggered again there’s another DAT with

opparm movTexture reload 1
opparm movTexture play 1

does that sound like the most efficient way to do this? am very curious if there are alternate solutions.

You should avoid reloading the movie since that’ll close the movie, clear memory and then reopen the file and realloc memory. Its much better to use the Cue parameter to move your playhead, if you are using sequential playback.