Thursday, February 6, 2014

Place a counter on video–Adobe After Affect

After affect is there to amaze me again. I had to host a video which keep on running for a day or two in loop. Since the video was a multicast (and not video on demand), it was like a TV show, which keeps on running and anyone who logs in will watch the show from that moment and not the beginning.

I wanted to let the viewer know that amount of time left in the video so that he can wait for the next loop to start. AE comes to the rescue.

I used a wonderful script written by Dan 

Steps involved -

1. Open a new composition

2. Add the video

3. Add a text layer

4. On source text add the below code. Update line 2 as per the timer requirements. Its actually number of seconds.

image

 

 

Code ---

rate = -1;
clockStart = 300;

function padZero(n){
if (n < 10) return "0" + n else return "" + n
}
clockTime = Math.max(clockStart + rate*(time - inPoint),0);
t = Math.floor(clockTime);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
min + ":" + padZero(sec)