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
About these ads

One Response to delay-srt: Increase/Decrease Delay of Subtitle

  1. mikaelf says:

    Thanks a lot! Using it now :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 31 other followers

%d bloggers like this: