node.jsnpmmillisecondstimecodes

NPM library: Converting Milliseconds to Timecode help needed?


Can someone help with a quick script that will convert Milliseconds to Timecode (HH:MM:SS:Frame) with this NPM library?

https://www.npmjs.com/package/ms-to-timecode

I just need to pass a miliseconds number (ie 7036.112) to it and output the converted timecode. I've installed npm and the ms-to-timecode library on my debian server. I know perl/bash, and never coded with these library modules.

Any help is greatly appreciated. -Akak


Solution

  • You need to write a javascript code to use this npm module.

    const msToTimecode = require('ms-to-timecode');
    const ms = 6000;
    const fps = 30
    
    const result = msToTimecode(ms, fps)
    console.log(result) // Print 00:00:06:00