srt-transform
Shift and stretch a '.srt' subtitle file using a linear transform.
Suppose you have an italian.srt
subtitle file, correctly synced with the audio of the movie you are watching,
but you have an english.srt
file that is out of sync; with srt-transform.py
you can fix timestamps of the second
one: you only need to find two couples of corresponding sentences in the subtitle files.
Best results are obtained choosing the first couple of sentences at the beginning of the movie, and
the second couple at the very end.
Tutorial
- Open
italian.srt
-- the correctly synced subtitle:
1
00:03:23,850 --> 00:03:25,602
Eco 3 a Eco 7.
2
00:03:25,730 --> 00:03:27,641
Jan, vecchio mio, mi senti?
3
00:03:27,770 --> 00:03:29,726
<i>Forte e chiaro, ragazzo. Che c'è?</i>
....
1129
01:55:32,458 --> 01:55:34,574
Chewie, aspetto tue notizie.
1130
01:55:34,698 --> 01:55:36,336
State attenti, voi due.
1131
01:55:36,458 --> 01:55:38,813
<i>Che la Forza sia con voi.</i>
-
Take note of an initial correct timestamp, for example
00:03:25,730
from subtitle #2, and a final correct timestamp, for example01:55:36,458
from subtitle #1131. -
Now we have the first two arguments for
srt-transform.py
:--start-right 00:03:25,730
--end-right 01:55:36,458
-
Open
english.srt
-- the subtitle out of sync:
1
00:03:33,479 --> 00:03:35,413
Echo Three to Echo Seven.
2
00:03:35,481 --> 00:03:37,415
Han, old buddy, do you read me?
3
00:03:37,483 --> 00:03:39,417
<i>Loud and clear, kid. What's up?</i>
....
1528
01:58:57,792 --> 01:58:59,836
Chewie, I'll be waiting for your signal.
1529
01:59:00,378 --> 01:59:01,488
Take care, you two.
1530
01:59:02,006 --> 01:59:03,361
<i>May the Force be with you.</i>
-
The corresponding translations of Italian subtitle #2 and #1131 are English #2 and #1530, so we pick timestamps
00:03:35,481
and01:59:02,006
-
Now we have the other two arguments for
srt-transform.py
:--start-wrong 00:03:35,481
--end-wrong 01:59:02,006
-
Let's put it together! Open a bash shell,
cd
to the path where you have installed the program, and write:
./srt-transform.py --start-right 00:03:25,730 --start-wrong 00:03:35,481 --end-right 01:55:36,458 --end-wrong 01:59:02,006 english.srt english-ok.srt
- Press enter, wait a parsec and enjoy your new
english-ok.srt
.
Install
$ sudo apt-get install python3 python3-pip && pip3 install --user --upgrade pip argparse chardet
$ git clone https://github.com/antoniocoratelli/srt-transform.git
Usage
See ./srt-transform.py -h
.
Support
If you like this application, you can share it, buy me a coffe, or just say thanks adding a star :)