Packages
vtc
0.1.3
0.17.5
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.9
0.16.8
0.16.7
0.16.6
0.16.5
0.16.4
0.16.2
0.16.1
0.16.0
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.5
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.13.15
0.13.14
0.13.13
0.13.12
0.13.11
0.13.10
0.13.9
0.13.8
0.13.7
0.13.6
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.12.1
0.12.0
0.11.1
0.11.0
0.10.10
0.10.9
0.10.8
0.10.7
0.10.6
0.10.5
0.10.4
0.10.3
0.10.2
0.10.1
0.10.0
0.9.2
0.9.1
0.9.0
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.3
0.7.2
0.7.1
0.7.0
0.6.1
0.6.0
0.5.3
0.5.2
0.5.1
0.4.0
0.3.9
0.3.8
0.3.7
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
A SMPTE timecode library for Elixir
Current section
Files
Jump to
Current section
Files
README.md
<h1 align="center">vtc-ex</h1>
<p align="center">
<img height=150 class="heightSet" align="center" src="https://raw.githubusercontent.com/opencinemac/vtc-py/master/zdocs/source/_static/logo1.svg"/>
</p>
<p align="center">A SMPTE Timecode Library for Elixir</p>
<p align="center">
<a href="https://dev.azure.com/peake100/Open%20Cinema%20Collective/_build?definitionId=19"><img src="https://dev.azure.com/peake100/Open%20Cinema%20Collective/_apis/build/status/vtc-ex?repoName=opencinemac%2Fvtc-ex&branchName=dev" alt="click to see build pipeline"></a>
<a href="https://dev.azure.com/peake100/Open%20Cinema%20Collective/_build?definitionId=19"><img src="https://img.shields.io/azure-devops/tests/peake100/Open%20Cinema%20Collective/19/dev?compact_message" alt="click to see build pipeline"></a>
<a href="https://dev.azure.com/peake100/Open%20Cinema%20Collective/_build?definitionId=19"><img src="https://img.shields.io/azure-devops/coverage/peake100/Open%20Cinema%20Collective/19/dev?compact_message" alt="click to see build pipeline"></a>
</p>
<p align="center">
<a href="https://hex.pm/packages/vtc"><img src="https://img.shields.io/hexpm/v/vtc.svg" alt="PyPI version" height="18"></a>
<a href="https://hexdocs.pm/vtc/readme.html"><img src="https://img.shields.io/badge/docs-hexdocs.pm-blue" alt="Documentation"></a>
</p>
Demo
----
Let's take a quick look at how we can use this library!
# It's easy to make a new 23.98 NTSC timecode. We use the with_frames constructor here
# since timecode is really a human-readable way to represent frame count.
iex> tc = Vtc.Timecode.with_frames!("17:23:13:02", Vtc.Rate.f23_98)
<17:23:00:02 @ <23.98 NTSC NDF>>
# We can get all sorts of ways to represent the timecode.
iex> Vtc.Timecode.timecode(tc)
"17:23:00:02"
iex> Vtc.Timecode.frames(tc)
1501922
iex> tc.seconds
751711961 <|> 12000
# We can inspect the framerate.
iex> tc.rate.ntsc
:NonDrop
iex> tc.rate.playback
24000 <|> 1001
iex> Vtc.Framerate.timebase(tc.rate)
24
# Parsing is flexible
# Partial timecode:
iex> Vtc.Timecode.with_frames!("3:12", Vtc.Rate.f23_98)
<03:00:00:12 @ <23.98 NTSC NDF>>
# Frame count:
iex> Vtc.Timecode.with_frames!(24, Vtc.Rate.f23_98)
<00:00:01:00 @ <23.98 NTSC NDF>>
# Seconds:
iex> Vtc.Timecode.with_seconds!(1.5, Vtc.Rate.f23_98)
<00:00:01:12 @ <23.98 NTSC NDF>>
# We can make dropframe timecode for 29.97 or 59.94 using one of the pre-set
# framerates.
iex> drop_frame = Vtc.Timecode.with_frames!(15000, Vtc.Rate.f29_97_Df)
<00:08:20;18 @ <29.97 NTSC DF>>
Features
--------
- SMPTE Conventions:
- [X] NTSC
- [X] Drop-Frame
- [ ] Interlaced timecode
- Timecode Representations:
- [X] Timecode | '01:00:00:00'
- [X] Frames | 86400
- [ ] Seconds | 3600.0
- [ ] Runtime | '01:00:00.0'
- [X] Rational | 18018/5
- [ ] Feet+Frames | '5400+00'
- [ ] 35mm, 4-perf
- [ ] 35mm, 3-perf
- [ ] 35mm, 2-perf
- [ ] 16mm
- [ ] Premiere Ticks | 15240960000000
- Operations:
- [ ] Comparisons (==, <, <=, >, >=)
- [ ] Add
- [ ] Subtract
- [ ] Scale (multiply and divide)
- [ ] Divmod
- [ ] Modulo
- [ ] Negative
- [ ] Absolute
- [ ] Rebase (recalculate frame count at new framerate)
- Flexible Parsing:
- [X] Partial timecodes | '1:12'
- [ ] Partial runtimes | '1.5'
- [X] Negative string values | '-1:12', '-3+00'
- [X] Poorly formatted tc | '1:13:4'
- [X] Built-in consts for common framerates.
- [ ] Range type for working with and comparing frame ranges.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `vtc` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:vtc, "~> 0.1"}
]
end
```