Powershell: How to Shift Time Offset of a Movie’s Subtitle

I usually go through my holidays with good movies. Some of the subtitles I downloaded do not have a correct timing with the video soundtrack. And it makes me re-adjust the subtitle whenever I re-play old movies. Since I do not want to install extra software or use websites to change my file whenever I get this problem, I decided to make it work in powershell. It takes me more than expected time in writing script as I want to include running dots while changing the time offset of the file. No matter what ! You can try out the script if you want.
The picture is from “Unstoppable(2010)”. And, subtitle is 3 seconds faster than soundtrack. So, I had to adjust the subtitle offset in VLC media player menu.
Tools >> Track Synchronization and subtract 3 seconds for delay. See Fig-1.
(The scene of this film in this blog is only for illustrative purpose only. Non-commercial)

Fig-1: The incorrect timing of the subtitle file

As I had to lag the subtitle file 3 sec. I have to run the script with -sec -3 parameter. (In case where the soundtrack is faster than the subtitle, you need to give -sec +3 second to overtake with the soundtrack). So, I put it all together.
.\Shift_Subtitle_Time_Track.ps1 -SourceFile .Unstoppable.2010.1080p.BrRip.x264.srt -sec -3

Fig-2: Make a 3 sec delay for each subtitle content in file

The new file will be appended with (new) word if you do not specify the new file name. So, it will be <oldfilename>(new).srt file. You also need to point your player to use the new subtitle file. See Fig-3.
Note that you can reset the VLC player subtitle synchronization settings to 0.

Fig-3: Now the Playback time and Subtitle time frame are the same

You can download my script from github.

This entry was posted in Powershell. Bookmark the permalink.

1 Response to Powershell: How to Shift Time Offset of a Movie’s Subtitle

  1. Cilvaring says:

    You are without questions a genius!!
    Your script just saved me hundreds of hours of editing SRT files by hand.

    Thanks a lot!!

Leave a Reply

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