[Matroska-devel] Storing USF subtitles in Matroska

Moritz Bunkus via Matroska-devel matroska-devel at lists.matroska.org
Sun Mar 20 19:38:50 CET 2016


Hey,

> Is this still something that has to be done?

mkvmerge has supported USF for ages, and there have been no changes in
just as long (last substantial change to USF support was in 2005). I'd
consider it… stable. Maybe »dead« would be more appropriate :)

Basically the specs could be described like this:

(A) CodecID: S_TEXT/USF

(B) CodecPrivate: The content of CodecPrivate is the XML content of the
    whole USF file with the <subtitles> node and all of its children
    removed.

(C) Entries: <subtitle> child node of the <subtitles> node is converted
    into a single Matroska block. The <subtitle>'s »start« attribute is
    used as the block's start timestamp. The difference between the
    node's »stop« and »start« attributes is used as the block's duration.

    The block's content is the whole <text> child of the <subtitle> node
    including all of its content. The opening and closing <text> </text>
    tags are part of the content, too.

Example. Let's assume this simple USF file:

--start-----------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- DOCTYPE USFSubtitles SYSTEM "USFV100.dtd" -->
<?xml-stylesheet type="text/xsl" href="USFV100.xsl"?>
<USFSubtitles version="1.00">
	<metadata>
	 <resolution x="640" y="480"></resolution>
	</metadata>
  <styles>
		<style name="Default">
			<fontstyle face="Tahoma" family="Tahoma" size="22" color="#7FFFFFDF" outline-color="#FF002953" outline-level="6" shadow-level="0" back-color="#7F007FFF"/>
			<position alignment="BottomCenter" vertical-margin="50%" relative-to="Window" horizontal-margin="2%"/>
		</style>
	</styles>
	<subtitles>
		<subtitle start="00:00:01.120" stop="00:00:04.265">
			<text>No fair! You changed the outcome by measuring it!</text>
		</subtitle>
  </subtitles>
</USFSubtitles>
--end-------------------------------------------------------

CodecPrivate will look like this:

--start-----------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- DOCTYPE USFSubtitles SYSTEM "USFV100.dtd" -->
<?xml-stylesheet type="text/xsl" href="USFV100.xsl"?>
<USFSubtitles version="1.00">
	<metadata>
	 <resolution x="640" y="480"></resolution>
	</metadata>
  <styles>
		<style name="Default">
			<fontstyle face="Tahoma" family="Tahoma" size="22" color="#7FFFFFDF" outline-color="#FF002953" outline-level="6" shadow-level="0" back-color="#7F007FFF"/>
			<position alignment="BottomCenter" vertical-margin="50%" relative-to="Window" horizontal-margin="2%"/>
		</style>
	</styles>
</USFSubtitles>
--end-------------------------------------------------------

The first <subtitle> node's corresponding block will start at
00:00:01.120, have a duration of 3s 145ms and look like this:

--start-----------------------------------------------------
<text>No fair! You changed the outcome by measuring it!</text>
--end-------------------------------------------------------

Kind regards,
mosu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.matroska.org/pipermail/matroska-devel/attachments/20160320/a540a81d/attachment.sig>


More information about the Matroska-devel mailing list