srttiming Wiki
a commandline tool for manipulating time values in .SRT subtitle files
Status: Beta
Brought to you by:
urgenc
srttiming is a tiny command-line application which converts pace and offset of .SRT subtitle files among different frame rates.
srttiming converts ALL the time labels in the original .srt file according to given PACE and OFFSET values.
srttiming can also calculate PACE and OFFSET values from given REFERENCE TIME POINTS.
Currently intended for Linux/Unix platforms.
Help screen is as follows :
srttiming is a command line application
which converts pace and offset of .SRT subtitle files among different frame rates
srttiming { { -c coefficient offset } |
| { -t|-tl current_srt_time_1 current_srt_time_2 actual_time_1 actual_time_2}
| { -f srt_frame_rate movie_frame_rate }
}
[input_file_name [output_file_name]]
where :
-c is direct coefficient and offset usage with 2 parameters :
coefficient is the pace of the subtitles
its value is multiplied
by the original time value (from the input .srt file)
coeffcient should be greater than 0
if the coefficient is greater than 1.0 then the pace of the subtitles decrease
if the coefficient is less than 1.0 then the pace of the subtitles increase
it is wise to specify at least 5 digits after the floating point
e.g. 1.00235 or 0.99967
a precision loss of 0.001 will result in a gap of 1 second
within 16 minutes and 40 seconds of playtime
a precision loss of 0.0001 will result in a gap of 1 second
within 166 minutes of playtime
offset is the value in seconds that will be added to
coefficient*original_time
Threfore
resulting_time = coefficient * original_time + offset
e.g.
coefficient = 0.9561
offset = -0.25
original_time = 25:18,700
then
resulting_time = 24:11,779
-t is calculation of coefficient and offset values from 4 reference time points
the longer time period between the reference time points
yields to more accurate calculation
current_srt_time_1 is the first reference point in the current subtitle (.srt) file
current_srt_time_2 is the second reference point in the current subtitle (.srt) file
actual_time_1 is the actual time in the movie where current_srt_time_1 should have been
actual_time_2 is the actual time in the movie where current_srt_time_2 should have been
format :
all the parameters are in "hours:minutes:seconds,milisecons" format
e.g. 02:44:21,389
-tl is the same as -t except it only displays calculated coefficient and offset values and exits
-f is calculation of coefficient from the frame rates of the subtitle (.srt) file and the movie
offset is always assumed as 0.0
srt_frame_rate is the assumed frame rate of the subtitle(.srt) file
movie_frame_rate is the frame rate of the actual movie
e.g.
-f 23.98 24
would increase the pace of the subtitle by the coefficient value of 0.999166
-f 25 24
would decrease the pace of the subtitle by the coefficient value of 1.041666
input_file_name is the original SRT file
specify as "-" for standard input
default input file is standard input
output_file_name is the resulting SRT file
default output file is standard output
examples :
srttiming -c 1.0025 -0.58 old.srt new.srt
srttiming -t 00:04:21,0 02:44:00,0 00:04:22,0 02:46:36,0 old.srt new.srt
srttiming -tl 00:04:21,0 02:44:00,0 00:04:22,0 02:46:36,0
srttiming -f 25.0 23.976 old.srt new.srt
note : That help info is printed to "stderr",
in order to redirect the output to "stdout" use "2>&1" in bash shell
e.g.
srttiming 2>&1 | more
Author : Ozgur Urgenc 2018
Programmed in C .