Skip to content

Commit

Permalink
feat: add FindTimecode method to metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
connerdouglass committed Mar 16, 2024
1 parent 9f275cc commit 353f3fc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions metadata/ffprobe_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,23 @@ func (m *Meta) GetVideoStream() *StreamMeta {
return nil
}

func (m *Meta) FindTimecode() string {
if m.Format.Tags != nil {
if timecode, ok := m.Format.Tags["timecode"]; ok && len(timecode) > 0 {
return timecode
}
}
for _, stream := range m.Streams {
if stream.Tags != nil {
if timecode, ok := stream.Tags["timecode"]; ok && len(timecode) > 0 {
return timecode
}

}
}
return ""
}

// GetFrameRate gets the frame rate / sample rate of the stream, represented as a fraction with numerator and denominator.
func (sm *StreamMeta) GetFrameRate() (int, int, error) {
num, den, _ := parseFraction(sm.RFrameRate)
Expand Down

0 comments on commit 353f3fc

Please sign in to comment.