An SRT subtitle offsetter using powershell

I get to deal with .srt files a lot at the moment. Not only does everything we produce needs to meet accessibility standards, but the default for social media video is that since it auto-plays without sound you need subtitles burnt-in so that people can watch it without clicking on it.

Due to frustration with the slowness and buggyness of Adobe’s subtitle tools I’ve built a streamlined subtitle burner-inner, which I will post soon, but at the moment it’s got a lot of only-works-on-my-machine-ism hard-coded into it.

For now, here’s a useful tool I built because I had the task of shifting all the subtitles in a file to cope with titles being added to the head, affecting all the timings. Rather than pay for a rush transcription job I built this.

One of the cool things about the script is that it uses powershell’s built-in date-time object to  do all the time calculations. That makes it super easy – I’ve done this kind of thing with bash and JS a few times and it always involves lots of string parsing and mucking around with numbers to add and subtract timecodes.

Useful tip: ffmpeg can convert subtitle files, so to turn say, an .ass file into a .srt file, or vice-versa you just run ffmpeg -i foo.ass


Also it’s on GitHub. I finally made friends with git! So you can fork it at your leisure. Or if you just want to download it and run it, click here


  1. You can also use ffmpeg to shift sub times.

    ffmpeg -i -c copy -output_ts_offset 4.52

    All subtitle times will be delayed 4.52 seconds.

    You can make them earlier, to bring forward 2.1 secs

    ffmpeg -i -c copy -output_ts_offset -2.1

    However, when bringing them forward, ffmpeg will not produce negative timings. So if in the above case, the first line starts at 1.5 secs, then the offset will be -1.5 i.e. first line starts at 0, and all other timings are decreased by 1.5.


  2. Awesome, I’ve just reinvented the wheel. I should have checked to see if ffmpeg could do it.

    Oh well, my time was not completely wasted, I learned how to make a git repository and about PS datetime functions, so there’s that.


Leave a Reply

Your email address will not be published. Required fields are marked *