View Source Vtc.Framerate (vtc v0.4.0)

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

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

struct-fields

Struct 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 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.

Link to this section Types

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

Enum of Ntsc types.

values

Values

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

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

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

Type returned by new/2

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

Type of Framerate

Link to this section Functions

Link to this function

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

View Source
@spec new(Vtc.Utils.Rational.t() | float() | String.t(), ntsc(), boolean()) ::
  parse_result()

Creates a new Framerate with a playback speed or timebase.

arguments

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
@spec new!(Vtc.Utils.Rational.t() | float() | String.t(), ntsc(), boolean()) :: t()

As new/2 but raises an error instead.

@spec 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.

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

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