Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression to display remaining time in timecode

  • Expression to display remaining time in timecode

    Posted by Jon Mendo on March 11, 2020 at 5:51 am

    Hey Smart People!
    I would LOVE some help with this and I can’t seem to find it anywhere. I would like to display the remaining comp time in timecode as the source text.

    I have several comps that I am rendering out to run through a media server and I would like to give my Resoulme Operator a way to see on the content how much time is remaining for each clip. Any help would be greatly appreciated.

    Thanks!
    Mendo

    Andrei Popa replied 6 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Andrei Popa

    March 11, 2020 at 9:03 am

    This works. You can also remove some values if you would like to not see them.


    function rawToTimecode(number) {
    var seconds = Math.floor(number);
    var minutes = Math.floor(seconds / 60);
    var hours = Math.floor(minutes / 60);
    var frames = Math.round((number - seconds) / thisComp.frameDuration);
    return [hours, minutes, seconds, frames]
    .map(
    function (n) {
    return (n > 10) ? n : "0" + n
    }
    ).join(":");
    }
    var rawTime = thisComp.duration - time;
    rawToTimecode(rawTime)

    Andrei
    My Envato portfolio.

  • Andrei Popa

    March 11, 2020 at 10:46 am

    I forgot to subtract the over-60 values in the end. This should be the correct way:
    function rawToTimecode(number){
    var seconds = Math.floor(number);
    var minutes = Math.floor(seconds / 60);
    var hours = Math.floor(minutes / 60);
    var frames = Math.round((number-seconds)/thisComp.frameDuration);
    return [hours,minutes%60,seconds%60,frames]
    .map(
    function(n){
    return(n>10) ? n : "0"+n
    }
    ).join(":");
    }
    var rawTime = thisComp.duration-time;
    rawToTimecode(rawTime)

    Andrei
    My Envato portfolio.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy