srt.py
is a simple Python script to manipulate soft subtitles in .srt
format. Most of the basic stuff of parsing the .srt
format is done, so it will be relatively easy to implement high-level manipulation commands. Currently only split
command is implemented.
For more information about the .srt
format, see here and here.
python srt.py split subtitle.srt 42:30 45:10
This will split subtitle.srt
into three parts, named subtitle.srt.000
, subtitle.srt.001
, subtitle.srt.002
, with the subtitle.srt.000
being 42 minutes and 30 seconds in length, subtitle.srt.001
being 45 minutes and 10 seconds in length, and subtitle.srt.002
the rest of the original file.
python srt.py shift subtitle.srt -,500 > new.subtitle.srt
This will move the subtitle 500 milliseconds towards the beginning. Output is redirected to the file named new.subtitle.srt
. Use this to sync subtitle with video.