Log in

View Full Version : Linux Subtitle "calculator"?


ravs
20th October 2021, 18:16
Is there something like a Linux Subtitle "calculator"?
By "calculator" I mean the following.

Suppose you have several episodes of a series, and you have created the Subtitle .ass file for one episode creating the subtitles for the intro song and probably also for the "extro" song.

Now, the intro starts at different times for each episode. I would need a way to convert e.g.
Dialogue: 0,0:22:55.00,0:23:05.50,Rava Dialogue,,0000,0000,0000,,I will head for tomorrow in this cradle woven from kindnessup or down certain minutes/seconds/milliseconds.

E.g. add 15 seconds zero milliseconds to the start time of 0:22:55:0,0 and the same offset to the end time of 0:23:05.50, making the above
Dialogue: 0,0:23:10.00,0:23:20.50,Rava Dialogue,,0000,0000,0000,,I will head for tomorrow in this cradle woven from kindness

Or minus 1 min 22 seconds .20 milliseconds. The relative times (relative to each other) in the .ass all stay the same, but all start and end times shift by the same difference.

quietvoid
21st October 2021, 14:12
You can run SubtitleEdit with mono, this is what I do.
The synchronization requires selecting specific lines, though.

qyot27
21st October 2021, 21:32
This is what you would use prass for.

https://github.com/tp7/prass (or maybe https://github.com/Ryu1845/Prass since it's been updated)

But you might need to splice the files apart first so only the lines that need to get shifted do (an alternative is that you could use ordered chapters and have the intro/outro in their own files, in which case the subs are always correctly timed). Or you know, just load the thing up in Aegisub and use it to perform the time shifting.

ravs
22nd October 2021, 04:05
You can run SubtitleEdit with mono, this is what I do.
The synchronization requires selecting specific lines, though.
as in https://github.com/SubtitleEdit/subtitleedit ?

This is what you would use prass for.
I check that out,
an alternative is that you could use ordered chapters and have the intro/outro in their own files, in which case the subs are always correctly timedyou mean like extracting an ffmetadata file
ffmpeg -i INPUT -f ffmetadata FFMETADATAFILEand after adding chapter info reinserting edited metadata information from the FFMETADATAFILE file
ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
?

If so, how does have the intro/outro in their own files work? You mean the video itself split?

Or chapters added via metadata (like the code above) but the video still only one file? If so how does that work? E.g. mpv loads subtitle when video and subtitle file have the same name.
E.g. video "whatever ep. 01.mp4" and subtitles "whatever ep. 01.ass"

qyot27
22nd October 2021, 05:09
Ordered chapters is a Matroska feature. It's possible through manipulating the XML chapters file and doing segment linking in combination, so that the OP file and ED files are separate, and each of the episodes has those segments removed (but the chapters file redirects the chapter points for the OP and ED to the external files).

ravs
22nd October 2021, 14:25
^

I see, so when one has another container but Matroska : only calculating and adjusting the e.g. .ass file is possible.