2023-02-11 Linear scaling of subtitles timestamps

Note: this post is a bit atypical – a tiny bit less technical than usual, a tiny bit more rantish than usual, a substantial bit more… strange than usual. If you read on, please try and stay awake.

Ok, so you’re still there. Well, thank you very much. It’s very nice of you. Your vote of confidence is overwhelming. All right.

As I have mentioned here a few times, I spend some time translating subtitles. That’s a prestigious line of work with a long and glorious tradition. However, there are many problems awaiting a bold adventurer who wants to do that. While I really like translating, it is a lot of effort, and sometimes I get the feeling that it’s just nothing but work, work, work, all the time. Well, life is pain. Anyone who says differently is selling something.

The way I usually proceed is that I first rip a dvd to get an .mp4 file (I don’t believe in streaming – a physical copy on a dvd is something nobody will take away from me. And yes, I have considered piracy, but decided against it on ethical grounds.) Then, I download English subtitles for a movie or series episode and then substitute Polish text for the English one. (Is downloading subtitles from the internet piracy? I don’t think so. I do own a dvd, it also has subtitles, and I could use SubRip to OCR them to .srt files (subtitles on dvds are stored as images, which is what it is). Also, I do not even distribute these files, just use them within a close circle of family and friends. So yes, if you asked this, I admit, you’re very smart. Now shut up.)

So, I usually already have an .srt file with (more or less) correct timestamps (and I can always fix minor timing issues on the fly when editing in Emacs’ excellent Subed mode). The trouble begins when the timestamps are off. There are often different versions of the film, like the ones ripped from a DVD or Blu-ray etc. It was no surprise for me that some of them are shifted by a few seconds – but I was really astonished to learn that some of them are faster or slower than my ripped file. While Emacs Subed mode can handle shifting all subtitles in the file by a fixed amount of time with ease, rescaling times to change the speed is not possible with it. And when I tried to download the .srt file for the best movie of all time, it turned out that every single one I tried had different speed than my .mp4 file! (Obviously, by now you should know very well which movie I’m talking about, and no, I am not sorry for all the dad jokes in this post. I really like to have some silly fun once in a while. In fact, it is the greatest thing in the world. Except for a nice MLT – a mutton, lettuce and tomato sandwich, where the mutton is nice and lean and the tomato is ripe.)

That felt really unfair. Well, who says life is fair? Where is that written? Life isn’t always fair. I wanted Polish subtitles (so that I’d be able to watch it with my family) so badly that I started to fix every single timestamp manually. Of course, I fell victim to one of the classic blunders – this is something a machine should handle. I knew my misery could end. Somewhere… somewhere close by must have been a man who can help me. But I couldn’t find him alone. I asked the search engine for help quite a few times, and finally one of my queries resulted with a success!

Enter Subs Edit (which is a set of subtitle-relating web apps), in particular its “progressive time delay” mode. It is an online service (which is the part I don’t like – well) with a very… specific UI. On the one hand, the way it handles inputting data is horrible – it seems you can only use the sliders, no typing of the timestamps by hand. On the other hand, the way you tell it how exactly you want the timestamps to be rescaled is really clever and intuitive. You paste your .srt file, click Import, and it shows you the first and last subtitles in the file. You tell it when they should appear on the screen – which is easy to measure with a tool like mpv – then click Apply Progressive Delay and download the rescaled file. That’s it!

And this way I was finally able to watch the movie with my family. There is, after all, a shortage of perfect movies in this world. It would be a pity not to be able to watch one of them in your mother tongue!

CategoryEnglish, CategoryBlog