0

Is there a way in python to convert timecodes, for example:

t1 = 00:05:08 in 24fps
==> What is t1 in 23.997 fps?

I basically want to convert from dropframe to non-dropframe and vice versa.

So far I have:

from timecode import Timecode
tc1 = Timecode('29.97', '00:04:22:04')
tc1. ?
David542
  • 104,438
  • 178
  • 489
  • 842
  • The [Final Cut Pro](https://documentation.apple.com/en/finalcutpro/usermanual/index.html#chapter=D%26section=6%26tasks=true) docs have some good stuff about this. – TigerhawkT3 Aug 31 '15 at 22:32
  • Perhaps you are looking for something like [timecode 0.3.0](https://pypi.python.org/pypi/timecode/0.3.0)? – TigerhawkT3 Aug 31 '15 at 22:50
  • @TigerhawkT3 yes that's what I'm trying to figure out but the documentation is a little bit slight. Any idea how I'd use that to convert from one timecode to another? – David542 Aug 31 '15 at 22:55

1 Answers1

1

I don't have timecode installed, but I've been reading through the source and it looks like you have to do the following:

  1. Create your initial Timecode object
  2. Get the number of frames it contains with its frames attribute
  3. Use that integer value to create a new Timecode object

It should look like this:

from timecode import Timecode

tc1 = Timecode('29.97', '00:04:22:04')
tc2 = Timecode('30', frames=tc1.frames)
TigerhawkT3
  • 48,464
  • 6
  • 60
  • 97