View Source Vtc.Framerate (vtc v0.7.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

Options for new/2 and new!/2.

Enum of Ntsc types.

Type returned by new/2

t()

Type of Framerate

Functions

Creates a new Framerate with a playback speed or timebase.

As new/2 but raises an error instead.

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 new_opts() :: [ntsc: ntsc(), invert?: boolean()]

Options for new/2 and new!/2.

@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: Ratio.t()}

Type of Framerate

Link to this section Functions

@spec new(Ratio.t() | number() | String.t(), new_opts()) :: 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.

options

Options

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

  • invert?: If true, the resulting rational rate value will be flipped so that 1/24 becomes 24/1. This can be helpeful when you are parsing a rate given in seconds-per-frame rather than frames-per-second. Default: false.

Float Precision

Only floats representing a whole number can be passed for non-NTSC rates, as there is no fully precise way to convert fractional floats to rational values.

@spec new!(Ratio.t() | number() | String.t(), new_opts()) :: 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()) :: Ratio.t()

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