[counter] [starttimestamp] --> [endtimestamp] [untertiteltextzeile1] [untertiteltextzeile2optional] [leerzeile]
def human2machine(human): machine = int(human[0:2])*60*60*1000 + int(human[3:5])*60*1000 + int(human[6:8])*1000 + int(human[9:]) return machine
def machine2human(machine): # calculate values stampH = math.floor(machine/3600000) machine = machine%3600000 stampM = math.floor(machine/60000) machine = machine%60000 stampS = math.floor(machine/1000) stampMS = machine%1000 # build string and add leading zeros # hour if stampH < 10: human = '0'+str(stampH)+':' else: human = str(stampH)+':' # minute if stampM < 10: human = human+'0'+str(stampM)+':' else: human = human+str(stampM)+':' # second if stampS < 10: human = human+'0'+str(stampS)+',' else: human = human+str(stampS)+',' # millisecond if stampMS < 1: human = human+'000' elif stampMS < 10: human = human+'00'+str(stampMS) elif stampMS < 100: human = human+'0'+str(stampMS) else: human = human+str(stampMS) return human
def processTimestamp(timestamp, changes): timestamp = human2machine(timestamp) # manipulate timestamp if not changes[0]: # changed fps multiplier = int(changes[1]) / int(changes[2]) timestamp = round(timestamp * multiplier) else: # just delay timestamp += int(changes[0]) timestamp = machine2human(timestamp) return timestamp
Könnt ihr mir weiterhelfen?
Gruß
#