4.3.0 • Published 2 years ago

framerate-utils v4.3.0

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

JavaScript Framerate Utils

Utilities for formatting and converting times to frame rates

Installation

npm install --save framerate-utils

Example usage

import { fromTag, secondsToSmpte } from 'framerate-utils';

const fr = fromTag('FPS_2397');
const seconds = 100;
const smpte = secondsToSmpte(fr, seconds);

console.log(smpte);
// output 00:01:39:21

API

There are numerous functions and constants available for use. While looking through methods if you come across a frameRate argument, you will need to create one first and pass that in.

This FrameRate object has the following shape:

{
  rate: number // The frame rate
  numerator: number // The numerator of the frame rate multiplier
  denominator: number // The denominator of the frame rate multiplier
  dropFrame: bool // drop mode, true - NTSC drop frame, false - non drop frame
  fps: number // The effective frame rate in frames per second (rate * (numerator/denominator))
}

And can be created using the following code:

import { create } from 'framerate-utils';

const frameRate = create();

Constants

  • SECONDS_PER_HOUR
  • SECONDS_PER_MINUTE
  • MILLISECONDS_PER_SECOND
  • TICKS_PER_SECOND

Functions

  • create(rate = 24, numerator = 1, denominator = 1, dropFrame = false) - Creates a new FrameRate object
  • secondsToSmpte(frameRate, seconds) - Returns seconds converted to SMPTE time.
  • smpteToSeconds(frameRate, smtpe) - Returns SMPTE time converted to seconds.
  • smpteToMs - Returns SMPTE time converted to milliseconds.
  • msToSmpte - Returns milliseconds converted to SMPTE time.

For all functions view the src/index.ts file.

4.3.0

2 years ago

4.2.1

2 years ago

4.2.0

2 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.0.1

6 years ago

3.0.0

7 years ago

2.0.0

7 years ago

1.0.2

7 years ago

1.0.0

8 years ago