Skip to content

agorman/go-timecode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status go report card GoDoc codecov

go-timecode

go-timecode simplifies the use of string based timecodes by providing conversions, frame based math, and support for SMTPE drop frame encoding. go-timecode offers a variety of industry standard formats out of the box but is designed to make it easy to work with any combination of formats you need.

Installation

go get github.com/agorman/go-timecode/v2

Documentation

https://godoc.org/github.com/agorman/go-timecode/v2

Basic usage

tc, err := timecode.Parse(timecode.R30, "01:30:12:15")
if err != nil {
    panic(err)
}

tc.String()   # "01:30:12:15"
tc.Frames()   # 162375
tc.Seconds()  # 5412.5
tc := timecode.FromFrames(timecode.R2997DF, 162213)

tc.String()   # "01:30:12:15"
tc.Frames()   # 162213
tc.Seconds()  # 5407.1
tc, err := timecode.FromSeconds(timecode.R2398, 5412.625)
if err != nil {
    panic(err)
}

tc.String()   # "01:30:12:15"
tc.Frames()   # 129903
tc.Seconds()  # 5412.625
rate, err := timecode.NewRate(30, false)
if err != nil {
    panic(err)
}
rate.FPS()         # 30.0
rate.DropFrame()   # false
rate, err := timecode.ParseRate("30000/1001", true)
if err != nil {
    panic(err)
}
rate.FPS()         # 29.97
rate.DropFrame()   # true

About

go package for manipulating SMPTE timecode

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages