Skip to content

Instantly share code, notes, and snippets.

@klaxa
Created January 1, 2015 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klaxa/fb46f5737c1781bd7b53 to your computer and use it in GitHub Desktop.
Save klaxa/fb46f5737c1781bd7b53 to your computer and use it in GitHub Desktop.
Converts from frames to timestamps for 24 fps
def frame2ts(self, ts):
new_ts = ts / 24
new_ts_str = time.strftime('%H:%M:%S', time.gmtime(int(new_ts)))[1:]
ms = new_ts % 1
ms = Decimal(ms).quantize(Decimal('.01'), rounding=ROUND_DOWN)
new_ts_str += str(ms)[1:]
return new_ts_str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment