Vtc.Framerate (vtc v0.3.9) View Source

The rate at which a video file frames are played back.

Framerate is measured in frames-per-second (24/1 = 24 frames-per-second).

Link to this section Summary

Types

Enum of Ntsc types.

Type returned by new/2

t()

Type of Framerate

Functions

Creates a new Framerate with a playback speed or timebase.

Returns true if the value represents and NTSC framerate, therefore will return true on a Framerate with an :ntsc value of :non_drop and :drop.

The rational representation of the timecode timebase speed as a fraction in frames-per-second.

Example returns

Link to this section Types

Specs

ntsc() :: :non_drop | :drop | nil

Enum of Ntsc types.

Values

  • nil: Not an NTSC value
  • :non_drop A non-drop NTSC value.
  • :drop A drop-frame ntsc value.

For more information on NTSC standards and framerate conventions, see Frame.io's blogpost on the subject.

Specs

parse_result() :: {:ok, t()} | {:error, Vtc.Framerate.ParseError.t()}

Type returned by new/2

Specs

t() :: %Vtc.Framerate{ntsc: ntsc(), playback: Vtc.Utils.Rational.t()}

Type of Framerate

Fields

  • playback: The rational representation of the real-world playback speed as a fraction in frames-per-second.

  • ntsc: Atom representing which, if any, NTSC convention this framerate adheres to.

Link to this section Functions

Link to this function

new(rate, ntsc, coerce_seconds_per_frame? \\ true)

View Source

Specs

Creates a new Framerate with a playback speed or timebase.

Arguments

  • rate: Either the playback rate or timebase. For NTSC framerates, the value will be rounded to the nearest correct value.

  • ntsc: Atom representing the which (or whether an) NTSC standard is being used.

  • coerce_seconds_per_frame?: If true, then values such as 1/24 are assumed to be in seconds-per-frame format and automatically converted to 24/1. Useful when you want to convert strings from multiple sources when some are seconds-per-frame and others are frames-per-second. NOTE: if you expect to be dealing with record-rate values for timelapse use at your own risk!

NOTE: Floats cannot be passed if the rate is not NTSC and the value is not a while number, as there is no way to know the precise time do to floating-point errors.

Link to this function

new!(rate, ntsc, coerce_seconds_per_frame? \\ true)

View Source

Specs

new!(Vtc.Utils.Rational.t() | float() | String.t(), ntsc(), boolean()) :: t()

As new/2 but raises an error instead.

Specs

ntsc?(t()) :: boolean()

Returns true if the value represents and NTSC framerate, therefore will return true on a Framerate with an :ntsc value of :non_drop and :drop.

Specs

timebase(t()) :: Vtc.Utils.Rational.t()

The rational representation of the timecode timebase speed as a fraction in frames-per-second.

Specs

to_string(t()) :: String.t()

Example returns:

  • 23.98 NTSC DF
  • 23.98 NTSC NDF
  • 23.98 fps