How to get the length from Movie File In (TOP) — Tip in TouchDesigner#6

Partical Weng
Partical.grt
Published in
2 min readDec 21, 2021

You would like to get the length of the video in Movie File In (TOP).

Here are the 2 ways I used:

1. with MovieFileIn Class

First one is quite simple. Just use the MovieFileInTOP Class directly.

op(‘moviefilein1’).numSeconds

.numSeconds will show the length of your video.

Also, you can use .numImages to get the total frames in the video.

You can refer more information in the link below:

2. with Info (CHOP)

With Info (CHOP), you’ll get a lot of different values.

And now we just need two of them:

  • length (The total frames of the video)
  • sample_rate (The frames in 1 second)

You can use Select (CHOP) to select these two.

Last step, length divides sample_rate, you’ll get the seconds of the video.

Length / Sample Rate = Seconds

I used Math (CHOP) to do that, you can use script to achieve that as well.

--

--