PDA

View Full Version : Extended SRT spec (especially coordinate format) question


TheFluff
13th December 2004, 05:31
Since I am a lazy person who detests manual labor, I'm writing an SRT-to-ASS subtitle conversion script in Perl, mostly for my own use (I want to rip the subtitles of an anime DVD with a lot of custom positioning and such stuff). SubRip can write to SSA, but won't write the positioning tags (which really is what I'm after) nor the color tags (which would be nice to have but is optional, really).

During the writing of this script I've encountered a severe snag in the project: I can't figure out the extended SRT coordinate system for the life of me. This makes it very hard to convert it to SSA (which is much better documented).

Now a normal event in a extended SRT script looks something like this:

00:00:14,948 --> 00:00:18,247 X1:201 X2:516 Y1:397 Y2:423
<font color="#fbff1c">Whose side is time on?</font>

And an event with two lines of text looks like this:
00:02:36,389 --> 00:02:39,290 X1:203 X2:511 Y1:359 Y2:431
<font color="#fbff1c">Oh, I can't believe this!</font>
<font color="#fbff1c">This is so irritating!</font>

Not too much trouble so far, eh? The X[1,2] and Y[1,2] coordinates evidently mark where the text starts and ends, but if it's measured in pixels or (FOO) or (BAR) I don't know, and there is also the question from where they are measuring. The trouble really begins when we encounter an event like this:

00:10:30,796 --> 00:10:33,799 X1:117 X2:619 Y1:042 Y2:428
<font color="#ffffff">Career Preference Questionnaire</font>
<font color="#ffffff">#1 Preference</font>
<font color="#ffffff">Veterinarian</font>
<font color="#ffffff">#2 Preference</font>
<font color="#ffffff">Flower Shopkeeper</font>
<font color="#fbff1c">"Veterinarian." "Flower Shopkeeper."</font>

Now the headache starts settling in. On the DVD the top five lines are subtitles for a paper a character is holding, and thus is positioned at various places mid-screen, while the 6th line is ordinary speech. My question is: how the heck is six different lines positioned correctly with only four coordinates? Is the coordinates even designed to work with events like this? Is this why nothing supports the extended SRT spec? Does someone know?

Another question: is there any other way to convert VobSubs to SSA/ASS without losing the positioning information, i.e. have I been wasting my time?

Seimour
13th December 2004, 16:43
Have you tried Subtitle Workshop already? It can, as subrip, write to a lot of formats.

Anyway if you prefer doing things on your own (programming sth), let me know 'cos I'm lazy too :p

unmei
14th December 2004, 19:17
Yes, no :) you can't position these correctly with that few coordinates.

I think Subrip does not even tink about the possibility that it could have different aligns and line spacings on one picture. I bet it determines the coordinates for that SRT extension by drawing the minimal bounding box around all non-transparent pixels found in that vobsub frame..

TheFluff
17th December 2004, 05:22
That was what I suspected. fsck. Now I have to do it all by hand anyway... (and yes, I know that SubRip can output to SSA - but it still doesn't write any coordinates for me...)

Thanks for the answers, anyway.