Created
January 1, 2015 23:52
-
-
Save klaxa/fb46f5737c1781bd7b53 to your computer and use it in GitHub Desktop.
Converts from frames to timestamps for 24 fps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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