+import argparse
+import datetime
+import sys
+import re
+
+def get_new_line(line, delta):
+ match = re.match('(\d{2}:\d{2}:\d{2},\d{3}) --> (\d{2}:\d{2}:\d{2},\d{3})', line)
+ if match:
+ start = match.group(1)
+ end = match.group(2)
+ start_time = datetime.datetime.strptime(start, '%H:%M:%S,%f')
+ end_time = datetime.datetime.strptime(end, '%H:%M:%S,%f')
+ new_start_time = start_time + delta
+ new_end_time = end_time + delta
+ return f"{new_start_time.strftime('%H:%M:%S,%f')[:-3]} --> {new_end_time.strftime('%H:%M:%S,%f')[:-3]}\n"
+ return line
+
+parser = argparse.ArgumentParser(description='Adjust timestamps in a .srt file')
+parser.add_argument('--minutes', '-m', nargs='?', type=int, default=0)
+parser.add_argument('--seconds', '-s', nargs='?', type=int, default=0)
+args = parser.parse_args()
+
+delta = datetime.timedelta(minutes=args.minutes, seconds=args.seconds)
+for line in sys.stdin:
+ sys.stdout.write(get_new_line(line, delta))