def tc_to_frame(hh, mm, ss, ff):
    return ff + (ss + mm * 60 + hh * 3600) * frame_rate

def frame_to_tc(fn):
    ff = fn % frame_rate
s = fn // frame_rate
return s // 3600, s // 60 % 60, s % 60, ff
How to do timecode calculation?