delay-srt: Increase/Decrease Delay of Subtitle

I like to download .mkv video files together with .srt subtitle files. However, it is often that the subtitle has an offset to the video. Some players have the ability to adjust (increase or decrease) the delay of subtitle, but some do not. So I decided to write delay-srt as a solution and my first excersice in learning the Racket programming language.  You can access the source code at: https://github.com/wangkuiyi/delay-srt.

In order to use this program, you need to download and install Racket.

The following command increases the delay of 30 seconds to the subtitle file terminator-3.srt.

racket delay-srt.rkt -i 0:0:30,000 terminator-3.srt > new.srt

The delay should specified in the format “hours:minutes:seconds,milliseconds”.

You can also decrease the delay by substituting the parameter -i (or –increase-delay) to -d (or –decrease-delay).

I practiced using the unit test framework of Racket in this project. To run the unit test:

racket delay-srt-test.rkt

You can also compile this program into a native binary:

raco exe delay-srt.rkt
./delay-srt -i 0:0:30,000 terminator-3.srt > new.srt