View Source Vtc.Framerate (vtc v0.12.0)
The rate at which a video file frames are played back, measured in frames-per-second (24/1 = 24 frames-per-second). For more on framerate and why Vtc chooses to represent it as a rational number, see NTSC: Framerate vs timebase and The Rational Rationale
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.
using-as-an-ecto-type
Using as an Ecto Type
See PgFramerate for information on how to use
Framerate
in your postgres database as a native type.
Link to this section Summary
Parse
Creates a new Framerate with a playback speed or timebase.
As new/2
but raises an error instead.
Inspect
Returns true if the value represents and NTSC framerate.
The rational representation of the SMPTE timecode's 'logical speed'. For more on timebase and it's relationship to framerate, see: NTSC: Framerate vs timebase.
Functions
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
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 of Framerate
Link to this section Parse
@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?
: Iftrue
, the resulting rationalrate
value will be flipped so that1/24
becomes24/1
. This can be helpeful when you are parsing a rate given in seconds-per-frame rather than frames-per-second. Default:false
.coerce_ntsc?
: If true -- andntsc
is non-nil -- values will be coerced to the nearest valid NTSC rate. So24
would be coerced to24000/1001
, as would23.98
. This option must be set to true whenntsc
is non-nil and a float is passed. 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.
As new/2
but raises an error instead.
Link to this section Inspect
Returns true if the value represents and NTSC framerate.
Will return true on a Framerate with an :ntsc
value of :non_drop
and :drop
.
The rational representation of the SMPTE timecode's 'logical speed'. For more on timebase and it's relationship to framerate, see: NTSC: Framerate vs timebase.
Returned value is in frames-per-second.
Link to this section Functions
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.