PDA

View Full Version : .SRT [SubRip] file format specification needed


vax
6th April 2004, 12:09
I'm looking for a comprehensive specification of
the .srt (SubRip) file format.

I found such a topic at:

http://forum.doom9.org/showthread.php?s=&threadid=64396&highlight=SRT+format

but the link given (to matroska) did not contain the HTML tags
specs. I need to know what these tags can control - e.g bold, italics, etc.

Thanks in advance,
vax

McPoodle
7th April 2004, 01:28
I haven't seen this format fully documented, so I got it from the source code to the SubRip program:

The format has no header, and no footer. Each subtitle has four parts:

Line 1 is a sequential count of subtitles, starting with 1.

Line 2 is the start timecode, followed by the string " --> ", followed by the end timecode. Timecodes are in the format HH:MM:SS,MIL (hours, minutes, seconds, milliseconds). The end timecode can optionally be followed by display coordinates (example " X1:100 X2:600 Y1:050 Y2:100"). Without coordinates displayed, each line of the subtitle will be centered and the block will appear at the bottom of the screen.

Lines 3 onward are the text of the subtitle. New lines are indicated by new lines (i.e. there's no "\n" code). The only formatting accepted are the following:

<b>text</b>: put text in boldface
<i>text</i>: put text in italics
<u>text</u>: underline text
<font color="#00ff00">text</font>: apply green color formatting to the text (you can use the font tag only to change color)

Tags can be combined (and should be nested properly). Note that the SubRip code appears to prefer whole-line formatting (no underlining just one word in the middle of a line).

Finally, successive subtitles are separated from each other by blank lines.

Here is an example of an SRT file:

1
00:02:26,407 --> 00:02:31,356 X1:100 X2:100 Y1:100 Y2:100
<font color="#00ff00">Detta handlar om min storebrors</font>
<b><i><u>kriminella beteende och foersvinnade.</u></i></b>

2
00:02:31,567 --> 00:02:37,164
Vi talar inte laengre om Wade. Det aer
som om han aldrig hade existerat.

vax
7th April 2004, 13:46
Thanks, that was quite good.

I have an only (possible)remark.
As I have looked at a lot of srt files, the line terminator was always "\r\n" (CR/LF). You mentioned above just an "\r" (CR) terminator. Is it a mistake of yours or this just doesn't matter for the whole bunch of divx players out there.

thanks,
vax.

McPoodle
9th April 2004, 01:38
It's a text format, so I imagine all variations are possible, but since SubRip and so many of the programs that output SubRip format are written for the PC, lines will probably be split be CRLF more often than the alternatives.

ChristianHJW
13th April 2004, 10:27
http://matroska.org/technical/specs/subtitles/index.html

zarathus
4th April 2010, 20:54
:helpful:
Just for an update at the discussion, you might be interested in take a look at this: SubRip (.SRT) subtitles support in players (http://ale5000.altervista.org/subtitles.htm) and here in the VLC Forum (http://forum.videolan.org/viewtopic.php?f=7&t=49774).

Ch3vr0n
8th April 2010, 15:45
LOL talk about your thread necromancy. You're 6 years too late LMAO

Mystiqq
4th August 2010, 08:59
:helpful:
Just for an update at the discussion, you might be interested in take a look at this: SubRip (.SRT) subtitles support in players (http://ale5000.altervista.org/subtitles.htm) and here in the VLC Forum (http://forum.videolan.org/viewtopic.php?f=7&t=49774).

Thanks for posting this.