This utility allows to shift subtitles time
#!/usr/bin/perl -pl # time shift for srt subtitles BEGIN { ($dt = shift @ARGV) != 0 or print "Usage: $0 SECONDS file" and exit; } s{ (\d+) : (\d\d) : (\d\d) , (\d+) } { my @t = ($1, $2, $3, $4 + $dt * 1E3); $t[2] += $t[3] / 1E3; $t[3] %= 1E3; $t[1] += $t[2] / 60; $t[2] %= 60; $t[0] += $t[1] / 60; $t[1] %= 60; sprintf '%02d:%02d:%02d,%03d', @t; }gxe;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Time shift for SRT subtitles
by Anonymous Monk on Feb 19, 2012 at 14:48 UTC | |
Re: Time shift for SRT subtitles
by jdrago_999 (Hermit) on Sep 17, 2009 at 23:34 UTC | |
by ccn (Vicar) on Sep 18, 2009 at 15:20 UTC |
Back to
Cool Uses for Perl