[Matroska-devel] USF muxing

Moritz Bunkus moritz at bunkus.org
Sun May 22 09:47:59 CEST 2005


Hey guys,

as Chris has already announced I've just implemented the first version
of an USF subtitle reader and muxer into mkvmerge. It hasn't been tested
a lot, the format it uses is DEFINITELY not meant for "production" etc
etc etc.

Here I want to give an overview of how it muxes USF into Matroska. This
is meant as a basis for debate -- I don't know all that much about USF
subs in the first place, and there may be better ways regarding how to
store it inside Matroska.

I'm attaching the example file that Alex Noé has uploaded for me. I'll
refer to that.

So here it goes.

1. XML data is stored both in CodecPrivate and the blocks themselves.

2. The XML metadata (not the <metadata> element!): Stuff like the style
   sheet definition or the XML header is dropped. The <USFSubtitles>
   root element is dropped as well.

3. CodecPrivate. At the moment all but the <subtitles> elements beneath
   the <USFSubtitles> root element are copied into the CodecPrivate as
   they are. White spaces are stipped. The CodecPrivate will contain the
   <metadata>, <styles> etc nodes among others (basically really all
   that mkvmerge encounters safe for the <subtitles> element).

   This also means that the order in which the elements occured in the
   source file is destroyed. unmei said that order doesn't matter, and I
   hope it doesn't, so this shouldn't be a problem.

4. Each <subtitles> element is converted into one Matroska track. Each
   <language> element is converted into Matroska's language header
   field. The <languageext> element is dropped at the moment. Apart from
   the <subtitle> elements all other unknown elements beneath
   <subtitles> are dropped as well.

5. Each <subtitle> element is copied into one Matroska data block. The
   <subtitle> ... </subtitle> tags themselves are kept at the moment
   although I guess that they can/should be removed. The "start=" and
   "stop=" attributes of the <subtitle> element are stripped and
   converted into the start and duration of the Matroska data block. (The
   <subtitle> ... </subtitle> tags can be removed if there are no other
   attributes apart from "start=" and "stop=". Comments?)

6. Subtitles and CodecPrivate are compressed with ZLIB by default. This
   can be turned off manually by adding "--compression 0:none" on the
   command line before the input file or in the GUI.

7. CodecID is "S_TEXT/USF" at the moment, but as Chris pointed out, USF
   may also contain images. So maybe "S_USF" might be more
   appropriate. Comments?

8. mmg has been updated to list files with the extensions ".usf" and
   ".xml" for USF subtitles.

Here's the link:
http://www.bunkus.org/videotools/mkvtoolnix/win32/pre//mkvtoolnix-unicode-1.4.2-build20050522-1.rar

Comments more than welcome :)

Mosu

-- 
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds


-------------- next part --------------
<?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>
		<style name="title">
			<fontstyle size="36" color="#FFBF00" outline-color="#D20000" face="Tahoma" family="Tahoma" outline-level="3" shadow-level="0"/>
		</style>
		<style name="credits">
			<fontstyle color="#008000" outline-color="#FFBF00" face="Tahoma" family="Tahoma" outline-level="2" shadow-level="0"/>
		</style>
	</styles>
	<subtitles>
		<language code=""></language>
		<languageext code=""></languageext>
		<subtitle start="00:00:01.120" stop="00:00:04.112">
			<text>Was?! Ist das wahr, Drachen-Göttin, Jade?</text>
		</subtitle>
		<subtitle start="00:00:06.120" stop="00:00:09.112">
			<karaoke><k t="1000"/>Was?! Ist das wahr, <k t="1000"/>Drachen-Göttin, <k t="992"/><font  back-color="#7FDF0000">Jade?</font><k t="1"/></karaoke>
		</subtitle>
		<subtitle start="00:00:09.400" stop="00:00:11.356">
			<text>Ja, ich bin mir sicher,<br/>Drachen-Meister.</text>
		</subtitle>
		<subtitle start="00:00:11.640" stop="00:00:13.870">
			<text>Meine blinden Augen<br/>haben in die Zukunft gesehen.</text>
		</subtitle>
		<subtitle start="00:00:14.160" stop="00:00:16.913">
			<text>Alexiel wird auferstehen...!</text>
		</subtitle>
		<subtitle start="00:00:17.200" stop="00:00:21.876">
			<text>Aber ihre Auferstehung bringt für<br/>"Assiah", die physische Welt,</text>
		</subtitle>
		<subtitle start="00:00:22.160" stop="00:00:24.594">
			<text>eine nicht wiedergutzumachende<br/>Katastrophe mit sich.</text>
		</subtitle>
		<subtitle start="00:00:25.320" stop="00:00:27.356">
			<text>Und vergeßt nicht,</text>
		</subtitle>
		<subtitle start="00:00:27.640" stop="00:00:31.952">
			<text>die Auferstehung von Alexiel<br/>bedeutet für Setsuna Mudo den Tod.</text>
		</subtitle>
		<subtitle start="00:00:33.280" stop="00:00:35.953">
			<text>Tod? Setsuna wird sterben?</text>
		</subtitle>
		<subtitle start="00:00:36.880" stop="00:00:40.270">
			<text>"Es tut mir leid, aber<br/>jetzt kann ich nichts für dich tun."</text>
		</subtitle>
		<subtitle start="00:00:44.800" stop="00:00:47.394">
			<text>Ist mir doch egal, was aus ihm wird!</text>
		</subtitle>
		<subtitle start="00:00:48.120" stop="00:00:51.192">
			<text>Mir reicht es,<br/>wenn Alexiel zurückkommt.</text>
		</subtitle>
	</subtitles>
	<metadata>
		<title>Angel Sanctuary - OVA 2 (deutsch)[kraut]</title>
		<author>
			<name>[kraut]</name>
			<task>rip, typeset</task>
		</author>
		<date>2003-10-27</date>
		<language code="deu">Deutsch</language>
		<comment>Freigegeben ab 16 Jahren.<br/><br/>Angel Sanctuary ist graphisch ein typisches CLAMP-Werk, die Thematik um Geschwisterliebe und Welten/Himmel/Höllen ist jedoch sehr erwachsenenorientiert.<br/><br/>DVD-Backtext:<br/>Angel Sanctuary:<br/>Alexiel, höchster und geliebtester Engel des Himmels, verbündet sich mit einem Heer von Dämonen, führt eine Rebellion gegen Gott - und verliert den entscheidenden Kampf.<br/>Gefangengenommen und eingeschmolzen in Engelskristall wird Alexiel's Seele in dem Erdenjungen Setsuna Mudo wiedergeboren, ohne dass dieser etwas von seinem Schiksal ahnt. Den 16-jährigen Schüler, der seine leibliche Schwester Sara liebt, wie es einem Bruder untersagt ist, quälen mehr und mehr Horrorvisionen, als Engel und Dämonen auf die Erde strömen um Alexiel wiederzuerwecken. Im Angesicht des Kampfes auf Leben und Tod entwickelt Setsuna plötzlich übernatürliche Kräfte.<br/>Wird die Liebe zwischen Sara und Setsuna den Zorn des Himmels und der Hölle überstehen?<br/><br/>Mysik und Religion, verpackt in einer dramatischen wie actionreichen Story um eine leidenschaftliche, aber verbotene Liebe - das ist die Geschicht von Angel Sanctuary.<br/><br/>(c) Kaori Yuki / Hakusensha / Angel Sanctuary Commitee<br/>(p) 2003 OVA Films</comment>
	</metadata>
</USFSubtitles>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.matroska.org/pipermail/matroska-devel/attachments/20050522/c159451e/attachment.pgp>


More information about the Matroska-devel mailing list