Universal Subtitle Format

OpenSaveXMLMultilingual

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 typetext/xml
SpecificationUSF 1.1, a CoreCodec project (2010), kept online by Titlevision
Time precisionMilliseconds
Text encodingDeclared in the XML. UTF-8 unless it says otherwise.
StylingNamed styles, and <i>, <b>, <u> and <font> in the text
PositioningNine places and margins, for a style or a text
SpeakersA speaker on each text
LanguagesSeveral in one file, one <subtitles> block each, by ISO 639-2 code
In containersMatroska 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. 1 · Root

    <USFSubtitles>, with the version of USF it follows.

  2. 2 · Head

    The title, the authors and the language; the named styles subtitles can use.

  3. 3 · Language

    A <subtitles> block for each language, by its ISO 639-2 code.

  4. 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.

Kept in the .usf
  • 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
Nowhere to go
  • 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> with italic, bold or underline, as some tools write it;
  • a duration for a missing stop, 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

Subtitld's export dialog with USF chosen and speaker pictures embedded

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

2002

USF was first released in November 2002, a CoreCodec project meant as an XML alternative to Advanced SubStation Alpha.

1.1

The last version, of November 2010. Its specification still lists <s> among its plans.

VLC 0.9

From version 0.9, VLC shows USF's text and timing, with a little of its formatting, as VSFilter does.

Related formats

Have a .usf to fix?

Open it in Subtitld with the video and retime it on the waveform.

Download Subtitld