Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
small utility to shift times in .srt subtitle files
C
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README
srtshift.c

README

srtshift is a small program to shift textual subtitles in .srt format.

Usage:
	srtshift [-s S] [-d RANGE] [-n] [-r] [file] [-v]

The argument
	-s S
shifts all the subtitles in the file by S milliseconds, where S is an integer,
positive or negative.

The argument
	-d RANGE
will remove the specified range of subtitles. This is a comma-separated list of
intervals, eg. "-d 1-3,400" deletes subtitles 1, 2, 3, and 400. Indices that are
too high are gracefully ignored. Passing anything to -d implies -r (see below).

Normally srtshift prints the total number of subtitle entries read from the file
(it will actually _count_ them, not just read the index number of the last one),
as well as the number of subtitle entries written to output (in case -d was
passed). By passing the argument
	-n
you can disable this.

The argument
	-r
will "reindex" the subtitles in the file. It will read through the file
replacing the index numbers (whatever they might be) with 1, 2, 3, etc. This is
useful if you have to insert a new subtitle into the file: just insert it
manually, give it any index number you please, and run "srtshift -r" on the
file. Note that reindexing is done automatically if you deleted some indices
with the -d argument.

The output is printed into stdout.

NOTE: srtshift only deals with UNIX endlines (linefeed only). Convert your files
first if necessary.

Compilation:
	gcc -o srtshift srtshift.c -O2

Something went wrong with that request. Please try again.