python으로 만든 간단한 srt 자막 싱크 조절 코드
srt 파일의 싱크 조절이 필요해 간단하게 python으로 코드를 만들어 봤다. 테스트를 많이 해보진 못했지만, 싱크 조절하려 했던 파일들은 잘 동작하는 것을 확인했다. 코드는 다음과 같다. import os def srt_gettimems(line,offset): while(line[offset].isdecimal() == False): offset += 1 if line[offset] == '\r' or line[offset] == '\n': return 0 hh = int(line[offset:offset+2]) mm = int(line[offset+3:offset+5]) sec = int(line[offset+6:offset+8]) ms = int(line[offset+9:offset+12]) return (hh*360+mm*60+sec)*1000+ms def srt_conv2timestr(time_ms): ms = time_ms%1000 time_sec = int(time_ms/1000) sec = time_sec%60 mm = int(time_sec/60) hh = int(mm/60) mm = mm%60 return '%02d:%02d:%02d,%03d'%(hh,mm,sec,ms) def srt_modi...