View Full Version : STL timecode format


SLider3
7th May 2004, 13:54
Hi

I'm trying to code a small program to convert subtitles in the srt format to the Spruce subtitle format (.stl). But i noticed that the stl timecode format is a bit weird (hours:minutes:seconds:frames). what are this frames? And How do i calculate them?

unmei
7th May 2004, 18:11
forgot the "what are they part", so here it is: if your video is 25fps (PAL), there will be 25 frames in a second, thus 1 frame = 1/25 second. For NTSC it is 1 frame ~= 1/29.97 second etc

you cannot calculate them. You need to know them, mostly likely from the video file the subtitle goes to.

Eventually you have a field in the STL file's header to specify the framerate. Then you could just set (assume) a framerate and convert the timecodes according to that.
But a frame based subtitle will never be independent of the video frame rate, you will have to convert all timestamps if the subtitles are to be used with a video of different framerate.

now that is the reason i don't like and simply ignore fame based subtitle formats:p

SLider3
7th May 2004, 19:15
But, for example....if i have this time in a srt subtitle file:
01:02:11:885 --> 1:02:15:995

What will be the correponding timecode of a STL subtitle ...if the video is PAL and if the video is NTSC?


Other thing...if my video is PAL i can have this STL timecode:
01:02:11:25
or it should be:
01:02:12:00
?

Mtz
7th May 2004, 19:28
Subtitle Workshop can convert any subtitle format in .stl, and maybe other 50 formats.

Example form an .stl file made by Subtitle Workshop:

//Font select and font size
$FontName = Arial
$FontSize = 30

//Character attributes (global)
$Bold = FALSE
$UnderLined = FALSE
$Italic = FALSE

//Position Control
$HorzAlign = Center
$VertAlign = Bottom
$XOffset = 0
$YOffset = 0

//Contrast Control
$TextContrast = 15
$Outline1Contrast = 8
$Outline2Contrast = 15
$BackgroundContrast = 0

//Effects Control
$ForceDisplay = FALSE
$FadeIn = 0
$FadeOut = 0

//Other Controls
$TapeOffset = FALSE
//$SetFilePathToken = <<:>>

//Colors
$ColorIndex1 = 0
$ColorIndex2 = 1
$ColorIndex3 = 2
$ColorIndex4 = 3

//Subtitles
00:00:01:12,00:00:03:01,- Here you go.|- Thanks.
00:00:05:11,00:00:07:10,Come on. We gotta get outta here.
00:00:07:11,00:00:09:21,- Where's Boomer?|- He jumped the fence again.

Why do you want invent if it's already invented?
I'm missing something?

SLider3
7th May 2004, 20:39
@ Mtz
I already knew that Subtitle Workshop could do this conversion, but Subtitle Workshop doenst do everything i need ... so, i want to do do it myself, but, first need to know how to do the conversion correctly. ;)

unmei
8th May 2004, 04:45
i /guess/ that would be 1:02:11:22 -> 1:02:15:00 for PAL and i don't know why there should be a frame #25 rather than a frame #0 of the next second (i mean you don't have a millisecond #1000 in a second neither) ..but i never used STL so i don't know if the creators made such weird things :), similar, i don't know for sure they actually do round when converting from ms to frames, maybe you are supposed to truncate..

SLider3
8th May 2004, 17:08
Well....are this kind of details I need to know. :(

SLider3
9th May 2004, 19:41
Noone know this details about the STL format? or can give me a page with the STL specs or detailed information about this format? anything?

McPoodle
13th May 2004, 05:04
All you have to do is divide the milliseconds in the srt timecode by 1000, then multiply by 25 (PAL) or 30 (NTSC) to get the number of frames (rounding as necessary).

So, SRT

01:02:11:885 --> 1:02:15:995

becomes PAL STL

01:02:11:22,01:02:16:00 (24.875 frames, which is 0.125 of a frame less than a second, so I rounded up)

or NTSC STL

01:02:11:27,01:02:16:00 (29.95 frames, which is 0.05 of a frame less than a second, so I rounded up)

SLider3
14th May 2004, 15:15
In the Subrip options for stl subtitles i see a checkbox (when is NTSC) with "Drop frame". What's this for? What it means? Should it be checked for correct conversion?

McPoodle
14th May 2004, 16:56
NTSC had two slightly different timebases for timecodes, drop and non-drop. The rule is that the subtitles should use the same timebase as the video. TV is drop timebase, and anything captured on a digital camera is non-drop. I'd say, made one subtitle of each timebase, and see which one stays in sync with the video in your DVD authoring application (some authoring applications actually tell you which timebase the video is).

SLider3
15th May 2004, 19:39
But what fps value is used if the checkbox "Drop frame" is checked? 29,970?

SLider3
18th May 2004, 17:07
@ McPoodle
Can you answer my question please?

McPoodle
21st May 2004, 23:04
Sorry about that. The frame rate for drop is 30, but the average frame rate works out to 29.97 (because it skips two frames every minute but the tenth).

SLider3
17th June 2004, 01:13
What about the .spf file? (with the stl colors info)
Can somenone tell me what to write in it?

McPoodle
17th June 2004, 16:19
That one's a binary format, so you can't write it yourself. However, you can open any project in Maestro, get the palette the way you like, and then save it. The default palette if you don't use a file is Black, Off-Black (RGB 32, 32, 32), White, Red, Gray, Silver, Aqua, Fuschia, Yellow, Navy, Green, Maroon, Teal, Purple, Olive and White again (using the standard Windows definitions of those colors).

gogi
21st June 2004, 08:57
SLider3, are you think to post your program when you ready?
I'm be glad to try it.
10x
If this can help you whit something :
http://eztitles.com/index.phtml
look for EZConvert.

SLider3
21st June 2004, 19:05
I´m not doing any Suntitle's Editor. I'm just making a tool that receives a srt or sub file (or more than one), join them, changes the frame rate to PAL (in my case) and save it as a STL subtitle ready to be used by DVDMaestro. :)
btw, i don't like neither SubtitleWorkshop nor Subrip to create STL subtitles ...(they don't care about the italic/bold tags in the source subtitles).

McPoodle
22nd June 2004, 03:33
By the way, I looked at the source code for SubRip, and found that it wrote out the .spf file, so I was able to figure out its format:

The .spf file is 64 bytes long. The first byte is the R value for color 0, the second is the G value, the third is the B value, and the fourth is 0 (it would normally be the overlay value, but palettes use solid colors). This 4-byte pattern is then repeated for the other 15 colors. Therefore, the hex dump of the standard palette I described above is as follows:


0000 00 00 00 00 20 20 20 00 FF FF FF 00 FF 00 00 00
0010 80 80 80 00 C0 C0 C0 00 00 FF FF 00 FF 00 FF 00
0020 FF FF 00 00 00 00 80 00 00 80 00 00 80 00 00 00
0030 00 80 80 00 80 00 80 00 80 80 00 00 FF FF FF 00


Usually, SubRip only knows the four colors of the subtitle. In that case, it still writes a 64-byte file, but it only fills in the RGB values for the first four "slots" and leaves all the other bytes as 00.

gogi
22nd June 2004, 08:18
Originally posted by SLider3
I´m not doing any Suntitle's Editor. I'm just making a tool that receives a srt or sub file (or more than one), join them, changes the frame rate to PAL (in my case) and save it as a STL subtitle ready to be used by DVDMaestro. :)
btw, i don't like neither SubtitleWorkshop nor Subrip to create STL subtitles ...(they don't care about the italic/bold tags in the source subtitles).
First, sorry for my poor english :/
I mean not for Subtitle creating program, a program that convert subtile file in many format it's name EZConvert, and I post a link if this can help you whit something.
Btw, I'm not translator.
I agree whit you for SubtitleWorkshop and Subrip, I like FAB Subtitler, very profesional program, thats produce .stl subs.

SLider3
22nd June 2004, 13:01
Thanks a lot McPoodle :)