Universal Subtitle Format
The XML subtitle format of the Matroska years: named styles, several languages in one file, and room for more. Few players took it up, but it holds everything Subtitld keeps, so Subtitld keeps its projects in it.
At a glance
| Extension | .usf |
|---|---|
| Media type | text/xml |
| Specification | USF 1.1, a CoreCodec project (2010), kept online by Titlevision |
| Time precision | Milliseconds |
| Text encoding | Declared in the XML. UTF-8 unless it says otherwise. |
| Styling | Named styles, and <i>, <b>, <u> and <font> in the text |
| Positioning | Nine places and margins, for a style or a text |
| Speakers | A speaker on each text |
| Languages | Several in one file, one <subtitles> block each, by ISO 639-2 code |
| In containers | Matroska as S_TEXT/USF |
Anatomy of a file
An XML document: a head of metadata and styles, then a block of subtitles for each language.
<USFSubtitles version="1.0"> <metadata>…</metadata> <styles>…</styles> <subtitles> <language code="por"> Portuguese (Brazil) </language> <subtitle start="00:00:01.000" stop="00:00:02.500"> <text>Olá!</text> </subtitle> </subtitles> </USFSubtitles>
- 1 · Root
<USFSubtitles>, with the version of USF it follows. - 2 · Head
The title, the authors and the language; the named styles subtitles can use.
- 3 · Language
A
<subtitles>block for each language, by its ISO 639-2 code. - 4 · Subtitle
Its start, its stop (or its duration), and its text.
Times
Seconds alone will do. 100 is 00:01:40.000, and 1.5 one and a half seconds. A subtitle can give its duration instead of its stop.
Text
USF's text is a subset of XHTML: tags in lower case, properly nested, <br/> closed.
| Element | Effect | In Subtitld |
|---|---|---|
<i>, <b>, <u> |
Italic, bold, underline | Kept |
<font color="#00FF0000"> |
A colour, and a face, a size, an outline or a shadow | The colour kept |
<br/> |
A line break | Kept |
<s> |
Strikeout: on USF's list of plans, not in the specification | Written for strikeout; other tools may show the text plain |
<karaoke>, <k t="250"/> |
Karaoke timing | The text kept |
<image>, <shape> |
Pictures and drawings | Not kept |
Alpha comes first, and counts down. USF's colours are #AARRGGBB, with 00 opaque and FF transparent. #00FF0000 is solid red; #FF0000, without alpha, is too.
Styles and places
<style name="Narrator">
<fontstyle italic="yes"/>
<position alignment="TopCenter"/>
</style>
A text uses a style by name, <text style="Narrator">, and takes its font, colour, italic, weight and underline, and its place: one of nine, from TopLeft to BottomRight. A style named Default restyles every subtitle, so Subtitld writes none and players keep their own look.
Languages
Each language has its own <subtitles> block, named by its ISO 639-2 code: eng, fre, ger, por. A code can stand for more than one language as Subtitld knows them, so Subtitld writes each language's name in the element too, and reads por as Brazil's or Portugal's Portuguese by it.
<language code="por">
Portuguese (Brazil)
</language>
USF in Subtitld
Subtitld's projects are USF. A .usfx project is a USF with what it needs beside it, the video, the voices and the dubs, in one file.
- Every subtitle's text, formatting and place
- Translations, a block each
- Speakers, with their colours, and their pictures when asked
- Dubs and their voices, the clips themselves when asked
- Start and end, to the millisecond
- Fonts, sizes, outlines and shadows line by line
- Pictures, drawings and karaoke timing
- Effects
What Subtitld adds, other tools leave alone.
Opening a USF file
Subtitld reads what Subtitld writes and what other tools do:
- the encoding the XML declares;
- the italic, bold, underline, colour and place of the named style a text uses;
<font>withitalic,boldorunderline, as some tools write it;- a
durationfor a missingstop, and times as seconds alone; - several texts in one subtitle as its lines;
- each language's block matched to the first by time, so the blocks need not hold the same number of subtitles;
- ISO 639-2 codes and the languages' names, and the codes older Subtitld versions wrote.
A file that is not USF says so, and opens nothing.
Saving USF
USF keeps the whole project, so Export, then Subtitles and USF, asks only what to put inside:
- Embed speaker imagesEach speaker's picture, in base64, in its style.
- Embed audio clipsEach dub's clip, in base64, in its subtitle.
The file is UTF-8, its languages by ISO 639-2 code and name, with a title, which USF requires, and no Default style.
Trivia
USF was first released in November 2002, a CoreCodec project meant as an XML alternative to Advanced SubStation Alpha.
The last version, of November 2010. Its specification still lists <s> among its plans.
From version 0.9, VLC shows USF's text and timing, with a little of its formatting, as VSFilter does.
Related formats
-
.ttmlTimed Text Markup Language
-
.assAdvanced SubStation Alpha
-
.smiSynchronized Accessible Media Interchange
Open it in Subtitld with the video and retime it on the waveform.