Fixes ASS converter, adds some doc
This commit is contained in:
814
documentation/Subtitles.htm
Normal file
814
documentation/Subtitles.htm
Normal file
@@ -0,0 +1,814 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Subtitles</title>
|
||||
<meta name="description" content="">
|
||||
|
||||
<link rel="shortcut icon" href="https://www.matroska.org/images/favicon.ico" type="image/vnd.microsoft.icon">
|
||||
<link rel="stylesheet" href="Subtitles_files/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="Subtitles_files/main.css">
|
||||
<link rel="canonical" href="https://www.matroska.org/technical/subtitles.html">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class="site-header">
|
||||
<div class="wrapper">
|
||||
<a class="site-title" href="https://www.matroska.org/"><img src="Subtitles_files/logo.png" alt="The Matroska Media Container logo"></a>
|
||||
<nav class="site-nav">
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="sidebar col-md-2">
|
||||
<h2 class="block__title block-title">Menu</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://www.matroska.org/" title="Start page">Home</a></li>
|
||||
<li><a href="https://www.matroska.org/what_is_matroska.html" title="What is Matroska?">What is Matroska?</a></li>
|
||||
<li>Downloads
|
||||
<ul>
|
||||
<li><a href="https://www.matroska.org/downloads/mkclean.html" title="mkclean">mkclean</a></li>
|
||||
<li><a href="https://www.matroska.org/downloads/mkvalidator.html" title="mkvalidator">mkvalidator</a></li>
|
||||
<li><a href="https://www.matroska.org/downloads/libraries.html" title="libraries">libraries</a></li>
|
||||
<li><a href="https://www.matroska.org/downloads/mkvtoolnix.html" title="MKVToolNix">MKVToolNix</a></li>
|
||||
<li><a href="https://www.matroska.org/downloads/third_party.html" title="Third-party applications">Third-party applications</a></li>
|
||||
<li><a href="https://www.matroska.org/downloads/test_suite.html" title="Test suite">Test suite</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="https://www.matroska.org/source_code_repositories.html" title="Source code repositories">Source code repositories</a></li>
|
||||
<li><a href="https://www.matroska.org/faq.html" title="FAQ">FAQ</a></li>
|
||||
|
||||
<li><a href="https://www.matroska.org/index.html" title="Technical Details">Technical / Info</a>
|
||||
<ul>
|
||||
<li><a href="https://www.matroska.org/technical/basics.html" title="Basics">Basics</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/diagram.html" title="Data Layout">Data Layout</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/elements.html" title="Element Specifications">Element Specifications</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/notes.html" title="Specification Notes">Specification Notes</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/ordering.html" title="EBML Element Ordering">Element Ordering</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/chapters.html" title="Chapter Specifications">Chapters</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/menu.html" title="Menu Specifications">Menu</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/chapter_codecs.html" title="Chapter Codecs">Chapter Codecs</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/attachments.html" title="Attachments">Attachments</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/cues.html" title="Cues">Cues</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/streaming.html" title="Matroska Streaming">Streaming</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/codec_specs.html" title="Codec Mapping">Codec Mapping</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/subtitles.html" title="Subtitles">Subtitles</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/block_additional_mappings.html" title="Block Additional Mappings">Block Additional Mappings</a></li>
|
||||
<li>
|
||||
<a href="https://www.matroska.org/technical/tagging.html" title="Tag Specifications">Tags</a>
|
||||
<ul>
|
||||
<li><a href="https://www.matroska.org/technical/tagging-audio-example.html" title="Audio Tags Example">Audio Examples</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/tagging-video-example.html" title="Video Tags Example">Video Examples</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/tags-precedence.html" title="Tags Precedence">Tags Precedence</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="https://www.matroska.org/technical/matroska_implement.html" title="Implementation Recommendations">Implementation Recommendations</a></li>
|
||||
<li><a href="https://www.matroska.org/technical/ebml_rfc.html" title="EBML RFC">EBML RFC</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><a href="https://www.matroska.org/contributors.html" title="Contributors">Contributors</a></li>
|
||||
<li><a href="https://www.matroska.org/license.html" title="License">License</a></li>
|
||||
<li><a href="https://www.matroska.org/legal.html" title="Legal aspects">Legal aspects</a></li>
|
||||
<li><a href="https://www.matroska.org/logos_trademarks.html" title="Logos & trademarks">Logos & trademarks</a></li>
|
||||
<li><a href="https://www.matroska.org/contact.html" title="Contact">Contact</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="page-content col-md-10">
|
||||
<div class="wrapper">
|
||||
<h1 id="subtitles">Subtitles</h1>
|
||||
|
||||
<p>Because Matroska is a general container format, we try to avoid specifying the formats
|
||||
to store in it. This type of work is really outside of the scope of a container-only format.
|
||||
However, because the use of subtitles in A/V containers has been so limited (with the exception of DVD)
|
||||
we are taking the time to specify how to store some of the more common subtitle formats in Matroska.
|
||||
This is being done to help facilitate their growth. Otherwise, incompatibilities could prevent
|
||||
the standardization and use of subtitle storage.</p>
|
||||
|
||||
<p>This page is not meant to be a complete listing of all subtitle formats that will be used in Matroska,
|
||||
it is only meant to be a guide for the more common, current formats. It is possible that
|
||||
we will add future formats to this page as they are created, but it is not likely as any
|
||||
other new subtitle format designer would likely have their own specifications.
|
||||
Any specification listed here <strong>SHOULD</strong> be strictly adhered to or it <strong>SHOULD NOT</strong>
|
||||
use the corresponding Codec ID.</p>
|
||||
|
||||
<p>Here is a list of pointers for storing subtitles in Matroska:</p>
|
||||
|
||||
<ul>
|
||||
<li>Any Matroska file containing only subtitles <strong>SHOULD</strong> use the extension “.mks”.</li>
|
||||
<li>As a general rule of thumb for all codecs, information that is global to an entire stream
|
||||
<strong>SHOULD</strong> be stored in the CodecPrivate element.</li>
|
||||
<li>Start and stop timestamps that are used in a timestamps native storage format <strong>SHOULD</strong>
|
||||
be removed when being placed in Matroska as they could interfere if the file is edited
|
||||
afterwards. Instead, the Blocks timestamp and Duration <strong>SHOULD</strong> be used to say when the timestamp is displayed.</li>
|
||||
<li>Because a “subtitle” stream is actually just an overlay stream, anything with a transparency
|
||||
layer could be use, including video.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="images-subtitles">Images Subtitles</h2>
|
||||
|
||||
<p>The first image format that is a goal to import into Matroska is the VobSub subtitle format.
|
||||
This subtitle type is generated by exporting the subtitles from a DVD [@?DVD-Video].</p>
|
||||
|
||||
<p>The requirement for muxing VobSub into Matroska is v7 subtitles (see first line of the .IDX file).
|
||||
If the version is smaller, you must remux them using the SubResync utility from
|
||||
VobSub 2.23 (or MPC) into v7 format. Generally any newly created subs will be in v7 format.</p>
|
||||
|
||||
<p>The .IFO file will not be used at all.</p>
|
||||
|
||||
<p>If there is more than one subtitle stream in the VobSub set, each stream will need to be
|
||||
separated into separate tracks for storage in Matroska. E.g. the VobSub file contains
|
||||
streams for both English and German subtitles. Then the resulting Matroska file <strong>SHOULD</strong>
|
||||
contain two tracks. That way the language information can be dropped and mapped
|
||||
to Matroska’s language tags.</p>
|
||||
|
||||
<p>The .IDX file is reformatted (see below) and placed in the CodecPrivate.</p>
|
||||
|
||||
<p>Each .BMP will be stored in its own Block. The Timestamp with be stored in the Blocks Timestamp
|
||||
and the duration will be stored in the Default Duration.</p>
|
||||
|
||||
<p>Here is an example .IDX file:</p>
|
||||
|
||||
<pre><code class="language-vobsub"> # VobSub index file, v7 (do not modify this line!)
|
||||
#
|
||||
# To repair desynchronization, you can insert gaps this way:
|
||||
# (it usually happens after vob id changes)
|
||||
#
|
||||
# delay: [sign]hh:mm:ss:ms
|
||||
#
|
||||
# Where:
|
||||
# [sign]: +, - (optional)
|
||||
# hh: hours (0 <= hh)
|
||||
# mm/ss: minutes/seconds (0 <= mm/ss <= 59)
|
||||
# ms: milliseconds (0 <= ms <= 999)
|
||||
#
|
||||
# Note: You can't position a sub before the previous with a negative
|
||||
# value.
|
||||
#
|
||||
# You can also modify timestamps or delete a few subs you don't
|
||||
# like. Just make sure they stay in increasing order.
|
||||
|
||||
# Settings
|
||||
|
||||
# Original frame size
|
||||
size: 720x480
|
||||
|
||||
# Origin, relative to the upper-left corner, can be overloaded by
|
||||
# alignment
|
||||
org: 0, 0
|
||||
|
||||
# Image scaling (hor,ver), origin is at the upper-left corner or at
|
||||
# the alignment coord (x, y)
|
||||
scale: 100%, 100%
|
||||
|
||||
# Alpha blending
|
||||
alpha: 100%
|
||||
|
||||
# Smoothing for very blocky images (use OLD for no filtering)
|
||||
smooth: OFF
|
||||
|
||||
# In millisecs
|
||||
fadein/out: 50, 50
|
||||
|
||||
# Force subtitle placement relative to (org.x, org.y)
|
||||
align: OFF at LEFT TOP
|
||||
|
||||
# For correcting non-progressive desync. (in millisecs or
|
||||
# hh:mm:ss:ms)
|
||||
# Note: Not effective in DirectVobSub, use "delay: ... " instead.
|
||||
time offset: 0
|
||||
|
||||
# ON: displays only forced subtitles, OFF: shows everything
|
||||
forced subs: OFF
|
||||
|
||||
# The original palette of the DVD
|
||||
palette: 000000, 7e7e7e, fbff8b, cb86f1, 7f74b8, e23f06, 0a48ea, \
|
||||
b3d65a, 6b92f1, 87f087, c02081, f8d0f4, e3c411, 382201, e8840b, \
|
||||
fdfdfd
|
||||
|
||||
# Custom colors (transp idxs and the four colors)
|
||||
custom colors: OFF, tridx: 0000, colors: 000000, 000000, 000000, \
|
||||
000000
|
||||
|
||||
# Language index in use
|
||||
langidx: 0
|
||||
|
||||
# English
|
||||
id: en, index: 0
|
||||
# Uncomment next line to activate alternative name in DirectVobSub /
|
||||
# Windows Media Player 6.x
|
||||
# alt: English
|
||||
# Vob/Cell ID: 1, 1 (PTS: 0)
|
||||
timestamp: 00:00:01:101, filepos: 000000000
|
||||
timestamp: 00:00:08:708, filepos: 000001000
|
||||
</code></pre>
|
||||
|
||||
<p>First, lines beginning with “#” are removed. These are comments to make text file editing easier,
|
||||
and as this is not a text file, they aren’t needed.</p>
|
||||
|
||||
<p>Next remove the “langidx” and “id” lines. These are used to differentiate the subtitle
|
||||
streams and define the language. As the streams will be stored separately anyway,
|
||||
there is no need to differentiate them here. Also, the language setting will be stored
|
||||
in the Matroska tags, so there is no need to store it here.</p>
|
||||
|
||||
<p>Finally, the “timestamp” will be used to set the Block’s timestamp. Once it is set there,
|
||||
there is no need for it to be stored here. Also, as it may interfere if the file is edited,
|
||||
it <strong>SHOULD NOT</strong> be stored here.</p>
|
||||
|
||||
<p>Once all of these items are removed, the data to store in the CodecPrivate <strong>SHOULD</strong> look like this:</p>
|
||||
|
||||
<pre><code class="language-vobsub"> size: 720x480
|
||||
org: 0, 0
|
||||
scale: 100%, 100%
|
||||
alpha: 100%
|
||||
smooth: OFF
|
||||
fadein/out: 50, 50
|
||||
align: OFF at LEFT TOP
|
||||
time offset: 0
|
||||
forced subs: OFF
|
||||
palette: 000000, 7e7e7e, fbff8b, cb86f1, 7f74b8, e23f06, 0a48ea, \
|
||||
b3d65a, 6b92f1, 87f087, c02081, f8d0f4, e3c411, 382201, e8840b, \
|
||||
fdfdfd
|
||||
custom colors: OFF, tridx: 0000, colors: 000000, 000000, 000000, \
|
||||
000000
|
||||
</code></pre>
|
||||
|
||||
<p>There <strong>SHOULD</strong> also be two Blocks containing one image each with the timestamps “00:00:01:101” and “00:00:08:708”.</p>
|
||||
|
||||
<h2 id="srt-subtitles">SRT Subtitles</h2>
|
||||
|
||||
<p>SRT is perhaps the most basic of all subtitle formats.</p>
|
||||
|
||||
<p>It consists of four parts, all in text:</p>
|
||||
|
||||
<p>1. A number indicating which subtitle it is in the sequence.
|
||||
2. The time that the subtitle appears on the screen, and then disappears.
|
||||
3. The subtitle itself.
|
||||
4. A blank line indicating the start of a new subtitle.</p>
|
||||
|
||||
<p>When placing SRT in Matroska, part 3 is converted to UTF-8 (S_TEXT/UTF8) and placed
|
||||
in the data portion of the Block. Part 2 is used to set the timestamp of the Block,
|
||||
and BlockDuration element. Nothing else is used.</p>
|
||||
|
||||
<p>Here is an example SRT file:</p>
|
||||
|
||||
<pre><code class="language-srt">1
|
||||
00:02:17,440 --> 00:02:20,375
|
||||
Senator, we're making
|
||||
our final approach into Coruscant.
|
||||
|
||||
2
|
||||
00:02:20,476 --> 00:02:22,501
|
||||
Very good, Lieutenant.
|
||||
</code></pre>
|
||||
|
||||
<p>In this example, the text “Senator, we’re making our final approach into Coruscant.”
|
||||
would be converted into UTF-8 and placed in the Block. The timestamp of the block would
|
||||
be set to “00:02:17,440”. And the BlockDuration element would be set to “00:00:02,935”.</p>
|
||||
|
||||
<p>The same is repeated for the next subtitle.</p>
|
||||
|
||||
<p>Because there are no general settings for SRT, the CodecPrivate is left blank.</p>
|
||||
|
||||
<h2 id="ssaass-subtitles">SSA/ASS Subtitles</h2>
|
||||
|
||||
<p>SSA stands for Sub Station Alpha. It’s the file format used by the popular subtitle editor,
|
||||
<a href="http://wiki.multimedia.cx/index.php?title=SubStation_Alpha">SubStation Alpha</a>.
|
||||
This format is widely used by fansubbers.</p>
|
||||
|
||||
<p>It allows you to do some advanced display features, like positioning, karaoke, style managements…</p>
|
||||
|
||||
<p>For detailed information on SSA/ASS, see the <a href="http://moodub.free.fr/video/ass-specs.doc">SSA specs</a>.
|
||||
It includes an SSA specs description and the advanced features added by ASS format (standing for Advanced SSA).
|
||||
Because SSA and ASS are so similar, they are treated the same here.</p>
|
||||
|
||||
<p>Like SRT, this format is text based with a particular syntax.</p>
|
||||
|
||||
<p>A file consists of 4 or 5 parts, declared ala INI file (but it’s not an INI !)</p>
|
||||
|
||||
<p>The first, “[Script Info]” contains some information about the subtitle file,
|
||||
such as it’s title, who created it, type of script and a very important one: “PlayResY”.
|
||||
Be careful of this value, everything in your script (font size, positioning) is scaled by it.
|
||||
Sub Station Alpha uses your desktops Y resolution to write this value, so if a friend
|
||||
with a large monitor and a high screen resolution gives you an edited script,
|
||||
you can mess everything up by saving the script in SSA with your low-cost monitor.</p>
|
||||
|
||||
<p>The second, “[V4 Styles]”, is a list of style definitions. A style describe how will look
|
||||
a text on the screen. It defines font, font size, primary/…/outile colour, position, alignment, etc.</p>
|
||||
|
||||
<p>For example this:</p>
|
||||
|
||||
<pre><code class="language-ssa">Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, \
|
||||
TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, \
|
||||
Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
|
||||
Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,\
|
||||
0,1,1,2,2,5,5,30,0,0
|
||||
</code></pre>
|
||||
|
||||
<p>The third, “[Events]”, is the list of text you want to display at the right timing.
|
||||
You can specify some attribute here. Like the style to use for this event
|
||||
(<strong>MUST</strong>be defined in the list), the position of the text (Left, Right, Vertical Margin),
|
||||
an effect. Name is mostly used by translator to know who said this sentence.
|
||||
Timing is in h:mm:ss.cc (centisec).</p>
|
||||
|
||||
<pre><code class="language-ssa">Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, \
|
||||
Effect, Text
|
||||
Dialogue: Marked=0,0:02:40.65,0:02:41.79,Wolf main,Cher,0000,0000,\
|
||||
0000,,Et les enregistrements de ses ondes delta ?
|
||||
Dialogue: Marked=0,0:02:42.42,0:02:44.15,Wolf main,autre,0000,0000,\
|
||||
0000,,Toujours rien.
|
||||
</code></pre>
|
||||
|
||||
<p>“[Pictures]” or “[Fonts]” part can be found in some SSA file, they contains UUE-encoded
|
||||
pictures/font but those features are only used by Sub Station Alpha – i.e.
|
||||
no filter (Vobsub/Avery Lee Subtiler filter) use them.</p>
|
||||
|
||||
<p>Now, how are they stored in Matroska?</p>
|
||||
|
||||
<ul>
|
||||
<li>All text is converted to UTF-8</li>
|
||||
<li>All the headers are stored in CodecPrivate
|
||||
(Script Info and the Styles list)</li>
|
||||
<li>Start & End field are used to set TimeStamp
|
||||
and the BlockDuration element. the data stored is:</li>
|
||||
<li>Events are stored in the Block
|
||||
in this order: ReadOrder, Layer, Style, Name, MarginL, MarginR, MarginV, Effect,
|
||||
Text (Layer comes from ASS specs … it’s empty for SSA.) “ReadOrder field is needed
|
||||
for the decoder to be able to reorder the streamed samples as they were placed originally in the file.”</li>
|
||||
</ul>
|
||||
|
||||
<p>Here is an example of an SSA file.</p>
|
||||
|
||||
<pre><code class="language-ssa">[Script Info]
|
||||
; This is a Sub Station Alpha v4 script.
|
||||
; For Sub Station Alpha info and downloads,
|
||||
; go to \
|
||||
; [http://www.eswat.demon.co.uk/](http://www.eswat.demon.co.uk/)
|
||||
; or email \
|
||||
; [kotus@eswat.demon.co.uk](mailto:kotus@eswat.demon.co.uk)
|
||||
Title: Wolf's rain 2
|
||||
Original Script: Anime-spirit Ishin-francais
|
||||
Original Translation: Coolman
|
||||
Original Editing: Spikewolfwood
|
||||
Original Timing: Lord_alucard
|
||||
Original Script Checking: Spikewolfwood
|
||||
ScriptType: v4.00
|
||||
Collisions: Normal
|
||||
PlayResY: 1024
|
||||
PlayDepth: 0
|
||||
Wav: 0, 128697,D:\Alex\Anime\- Fansub -\- TAFF -\WR_-_02_Wav.wav
|
||||
Wav: 0, 120692,H:\team truc\WR_-_02.wav
|
||||
Wav: 0, 116504,E:\sub\wolf's_rain\WOLF'S RAIN 02.wav
|
||||
LastWav: 3
|
||||
Timer: 100,0000
|
||||
|
||||
[V4 Styles]
|
||||
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, \
|
||||
TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, \
|
||||
Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
|
||||
Style: Default,Arial,20,65535,65535,65535,-2147483640,-1,0,1,3,0,2,\
|
||||
30,30,30,0,0
|
||||
Style: Titre_episode,Akbar,140,15724527,65535,65535,986895,-1,0,1,1,\
|
||||
0,3,30,30,30,0,0
|
||||
Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,\
|
||||
0,1,1,2,2,5,5,30,0,0
|
||||
|
||||
[Events]
|
||||
Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, \
|
||||
Effect, Text
|
||||
Dialogue: Marked=0,0:02:40.65,0:02:41.79,Wolf main,Cher,0000,0000,\
|
||||
0000,,Et les enregistrements de ses ondes delta ?
|
||||
Dialogue: Marked=0,0:02:42.42,0:02:44.15,Wolf main,autre,0000,0000,\
|
||||
0000,,Toujours rien.
|
||||
</code></pre>
|
||||
|
||||
<p>Here is what would be placed into the CodecPrivate element.</p>
|
||||
|
||||
<pre><code class="language-ssa">[Script Info]
|
||||
; This is a Sub Station Alpha v4 script.
|
||||
; For Sub Station Alpha info and downloads,
|
||||
; go to \
|
||||
; [http://www.eswat.demon.co.uk/](http://www.eswat.demon.co.uk/)
|
||||
; or email \
|
||||
; [kotus@eswat.demon.co.uk](mailto:kotus@eswat.demon.co.uk)
|
||||
Title: Wolf's rain 2
|
||||
Original Script: Anime-spirit Ishin-francais
|
||||
Original Translation: Coolman
|
||||
Original Editing: Spikewolfwood
|
||||
Original Timing: Lord_alucard
|
||||
Original Script Checking: Spikewolfwood
|
||||
ScriptType: v4.00
|
||||
Collisions: Normal
|
||||
PlayResY: 1024
|
||||
PlayDepth: 0
|
||||
Wav: 0, 128697,D:\Alex\Anime\- Fansub -\- TAFF -\WR_-_02_Wav.wav
|
||||
Wav: 0, 120692,H:\team truc\WR_-_02.wav
|
||||
Wav: 0, 116504,E:\sub\wolf's_rain\WOLF'S RAIN 02.wav
|
||||
LastWav: 3
|
||||
Timer: 100,0000
|
||||
|
||||
[V4 Styles]
|
||||
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, \
|
||||
TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, \
|
||||
Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
|
||||
Style: Default,Arial,20,65535,65535,65535,-2147483640,-1,0,1,3,0,2,\
|
||||
30,30,30,0,0
|
||||
Style: Titre_episode,Akbar,140,15724527,65535,65535,986895,-1,0,1,1,\
|
||||
0,3,30,30,30,0,0
|
||||
Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,\
|
||||
0,1,1,2,2,5,5,30,0,0
|
||||
</code></pre>
|
||||
|
||||
<p>And here are the two blocks that would be generated.</p>
|
||||
|
||||
<p>Block’s timestamp: 00:02:40.650
|
||||
BlockDuration: 00:00:01.140</p>
|
||||
|
||||
<pre><code class="language-ssa">1,,Wolf main,Cher,0000,0000,0000,,Et les enregistrements de ses \
|
||||
ondes delta ?
|
||||
</code></pre>
|
||||
|
||||
<p>Block’s timestamp: 00:02:42.420
|
||||
BlockDuration: 00:00:01.730</p>
|
||||
|
||||
<pre><code class="language-ssa">2,,Wolf main,autre,0000,0000,0000,,Toujours rien.
|
||||
</code></pre>
|
||||
|
||||
<h2 id="webvtt">WebVTT</h2>
|
||||
|
||||
<p>The “Web Video Text Tracks Format” (short: WebVTT) is developed by the <a href="https://www.w3.org/">World Wide Web Consortium (W3C)</a>.
|
||||
Its specifications are <a href="https://w3c.github.io/webvtt/">freely available</a>.</p>
|
||||
|
||||
<p>The guiding principles for the storage of WebVTT in Matroska are:</p>
|
||||
|
||||
<ul>
|
||||
<li>Consistency: store data in a similar way to other subtitle codecs</li>
|
||||
<li>Simplicity: making decoding and remuxing as easy as possible for existing infrastructures</li>
|
||||
<li>Completeness: keeping as much data as possible from the original WebVTT file</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="storage-of-webvtt-in-matroska">Storage of WebVTT in Matroska</h3>
|
||||
|
||||
<h4 id="codecid-codec-identification">CodecID: codec identification</h4>
|
||||
|
||||
<p>The CodecID to use is <code class="language-plaintext highlighter-rouge">S_TEXT/WEBVTT</code>.</p>
|
||||
|
||||
<h4 id="codecprivate-storage-of-global-webvtt-blocks">CodecPrivate: storage of global WebVTT blocks</h4>
|
||||
|
||||
<p>This element contains all global blocks before the first subtitle entry. This starts at the “<code class="language-plaintext highlighter-rouge">WEBVTT</code>”
|
||||
file identification marker but excludes the optional byte order mark.</p>
|
||||
|
||||
<h4 id="storage-of-non-global-webvtt-blocks">Storage of non-global WebVTT blocks</h4>
|
||||
|
||||
<p>Non-global WebVTT blocks (e.g., “NOTE”) before a WebVTT Cue Text are stored in Matroska’s BlockAddition
|
||||
element together with the Matroska Block containing the WebVTT Cue Text these blocks precede
|
||||
(see below for the actual format).</p>
|
||||
|
||||
<h4 id="storage-of-cues-in-matroska-blocks">Storage of Cues in Matroska blocks</h4>
|
||||
|
||||
<p>Each WebVTT Cue Text is stored directly in the Matroska Block.</p>
|
||||
|
||||
<p>A muxer <strong>MUST</strong> change all WebVTT Cue Timestamps present within the Cue Text to be relative
|
||||
to the Matroska Block’s timestamp.</p>
|
||||
|
||||
<p>The Cue’s start timestamp is used as the Matroska Block’s timestamp.</p>
|
||||
|
||||
<p>The difference between the Cue’s end timestamp and its start timestamp is used as
|
||||
the Matroska Block’s duration.</p>
|
||||
|
||||
<h4 id="blockadditions-storing-non-global-webvtt-blocks-cue-settings-lists-and-cue-identifiers">BlockAdditions: storing non-global WebVTT blocks, Cue Settings Lists and Cue identifiers</h4>
|
||||
|
||||
<p>Each Matroska Block may be accompanied by one BlockAdditions element. Its format is as follows:</p>
|
||||
|
||||
<ol>
|
||||
<li>The first line contains the WebVTT Cue Text’s optional Cue Settings List followed by
|
||||
one line feed character (U+0x000a). The Cue Settings List may be empty, in which case
|
||||
the line consists of the line feed character only.</li>
|
||||
<li>The second line contains the WebVTT Cue Text’s optional Cue Identifier followed by
|
||||
one line feed character (U+0x000a). The line may be empty indicating that there was
|
||||
no Cue Identifier in the source file, in which case the line consists of the line feed character only.</li>
|
||||
<li>The third and all following lines contain all WebVTT Comment Blocks that precede
|
||||
the current WebVTT Cue Block. These may be absent.</li>
|
||||
</ol>
|
||||
|
||||
<p>If there is no Matroska BlockAddition element stored together with the Matroska Block,
|
||||
then all three components (Cue Settings List, Cue Identifier, Cue Comments) <strong>MUST</strong> be assumed to be absent.</p>
|
||||
|
||||
<h3 id="examples-of-transformation">Examples of transformation</h3>
|
||||
|
||||
<p>Here’s an example how a WebVTT is transformed.</p>
|
||||
|
||||
<h4 id="example-webvtt-file">Example WebVTT file</h4>
|
||||
|
||||
<p>Let’s take the following example file:</p>
|
||||
|
||||
<pre><code class="language-webvtt">WEBVTT with text after the signature
|
||||
|
||||
STYLE
|
||||
::cue {
|
||||
background-image: linear-gradient(to bottom, dimgray, lightgray);
|
||||
color: papayawhip;
|
||||
}
|
||||
/* Style blocks cannot use blank lines nor "dash dash greater \
|
||||
than" */
|
||||
|
||||
NOTE comment blocks can be used between style blocks.
|
||||
|
||||
STYLE
|
||||
::cue(b) {
|
||||
color: peachpuff;
|
||||
}
|
||||
|
||||
REGION
|
||||
id:bill
|
||||
width:40%
|
||||
lines:3
|
||||
regionanchor:0%,100%
|
||||
viewportanchor:10%,90%
|
||||
scroll:up
|
||||
|
||||
NOTE
|
||||
Notes always span a whole block and can cover multiple
|
||||
lines. Like this one.
|
||||
An empty line ends the block.
|
||||
|
||||
hello
|
||||
00:00:00.000 --> 00:00:10.000
|
||||
Example entry 1: Hello <b>world</b>.
|
||||
|
||||
NOTE style blocks cannot appear after the first cue.
|
||||
|
||||
00:00:25.000 --> 00:00:35.000
|
||||
Example entry 2: Another entry.
|
||||
This one has multiple lines.
|
||||
|
||||
00:01:03.000 --> 00:01:06.500 position:90% align:right size:35%
|
||||
Example entry 3: That stuff to the right of the timestamps are cue \
|
||||
settings.
|
||||
|
||||
00:03:10.000 --> 00:03:20.000
|
||||
Example entry 4: Entries can even include timestamps.
|
||||
For example:<00:03:15.000>This becomes visible five seconds
|
||||
after the first part.
|
||||
</code></pre>
|
||||
|
||||
<h4 id="example-of-codecprivate">Example of CodecPrivate</h4>
|
||||
|
||||
<p>The resulting CodecPrivate element will look like this:</p>
|
||||
|
||||
<pre><code class="language-webvtt">WEBVTT with text after the signature
|
||||
|
||||
STYLE
|
||||
::cue {
|
||||
background-image: linear-gradient(to bottom, dimgray, lightgray);
|
||||
color: papayawhip;
|
||||
}
|
||||
/* Style blocks cannot use blank lines nor "dash dash greater \
|
||||
than" */
|
||||
|
||||
NOTE comment blocks can be used between style blocks.
|
||||
|
||||
STYLE
|
||||
::cue(b) {
|
||||
color: peachpuff;
|
||||
}
|
||||
|
||||
REGION
|
||||
id:bill
|
||||
width:40%
|
||||
lines:3
|
||||
regionanchor:0%,100%
|
||||
viewportanchor:10%,90%
|
||||
scroll:up
|
||||
|
||||
NOTE
|
||||
Notes always span a whole block and can cover multiple
|
||||
lines. Like this one.
|
||||
An empty line ends the block.
|
||||
</code></pre>
|
||||
|
||||
<h4 id="storage-of-cue-1">Storage of Cue 1</h4>
|
||||
|
||||
<p>Example Cue 1: timestamp 00:00:00.000, duration 00:00:10.000, Block’s content:</p>
|
||||
|
||||
<pre><code class="language-webvtt">Example entry 1: Hello <b>world</b>.
|
||||
</code></pre>
|
||||
|
||||
<p>BlockAddition’s content starts with one empty line as there’s no Cue Settings List:</p>
|
||||
|
||||
<pre><code class="language-webvtt">
|
||||
hello
|
||||
</code></pre>
|
||||
|
||||
<h4 id="storage-of-cue-2">Storage of Cue 2</h4>
|
||||
|
||||
<p>Example Cue 2: timestamp 00:00:25.000, duration 00:00:10.000, Block’s content:</p>
|
||||
|
||||
<pre><code class="language-webvtt">Example entry 2: Another entry.
|
||||
This one has multiple lines.
|
||||
</code></pre>
|
||||
|
||||
<p>BlockAddition’s content starts with two empty lines as there’s neither a Cue Settings List nor a Cue Identifier:</p>
|
||||
|
||||
<pre><code class="language-webvtt">
|
||||
NOTE style blocks cannot appear after the first cue.
|
||||
</code></pre>
|
||||
|
||||
<h4 id="storage-of-cue-3">Storage of Cue 3</h4>
|
||||
|
||||
<p>Example Cue 3: timestamp 00:01:03.000, duration 00:00:03.500, Block’s content:</p>
|
||||
|
||||
<pre><code class="language-webvtt">Example entry 3: That stuff to the right of the timestamps are cue \
|
||||
settings.
|
||||
</code></pre>
|
||||
|
||||
<p>BlockAddition’s content ends with an empty line as there’s no Cue Identifier and
|
||||
there were no WebVTT Comment blocks:</p>
|
||||
|
||||
<pre><code class="language-webvtt">position:90% align:right size:35%
|
||||
|
||||
</code></pre>
|
||||
|
||||
<h4 id="storage-of-cue-4">Storage of Cue 4</h4>
|
||||
|
||||
<p>Example Cue 4: timestamp 00:03:10.000, duration 00:00:10.000, Block’s content:</p>
|
||||
|
||||
<p>Example entry 4: Entries can even include timestamps. For
|
||||
example:<00:00:05.000>This becomes visible five seconds after the
|
||||
first part.</p>
|
||||
|
||||
<p>This Block does not need a BlockAddition as the Cue did not contain an Identifier,
|
||||
nor a Settings List, and it wasn’t preceded by Comment blocks.</p>
|
||||
|
||||
<h3 id="storage-of-webvtt-in-matroska-vs-webm">Storage of WebVTT in Matroska vs. WebM</h3>
|
||||
|
||||
<p>Note: the storage of WebVTT in Matroska is not the same as the design document for storage
|
||||
of WebVTT in WebM. There are several reasons for this including but not limited to:
|
||||
the WebM document is old (from February 2012) and was based on an earlier draft of WebVTT
|
||||
and ignores several parts that were added to WebVTT later; WebM does still <a href="http://www.webmproject.org/docs/container/">not support subtitles at all</a>;
|
||||
the proposal suggests splitting the information across multiple tracks making
|
||||
demuxer’s and remuxer’s life very difficult.</p>
|
||||
|
||||
<h2 id="hdmv-presentation-graphics-subtitles">HDMV presentation graphics subtitles</h2>
|
||||
|
||||
<p>The specifications for the HDMV presentation graphics subtitle format (short: HDMV PGS)
|
||||
can be found in the document “Blu-ray Disc Read-Only Format; Part 3 — Audio Visual Basic Specifications”
|
||||
in section 9.14 “HDMV graphics streams”.</p>
|
||||
|
||||
<h3 id="storage-of-hdmv-presentation-graphics-subtitles">Storage of HDMV presentation graphics subtitles</h3>
|
||||
|
||||
<p>The CodecID to use is <code class="language-plaintext highlighter-rouge">S_HDMV/PGS</code>. A CodecPrivate element is not used.</p>
|
||||
|
||||
<h4 id="storage-of-hdmv-pgs-segments-in-matroska-blocks">Storage of HDMV PGS Segments in Matroska Blocks</h4>
|
||||
|
||||
<p>Each HDMV PGS Segment (short: Segment) will be stored in a Matroska Block.
|
||||
A Segment is the data structure described in section 9.14.2.1 “Segment coding structure and parameters”
|
||||
of the Blu-ray specifications.</p>
|
||||
|
||||
<p>Each Segment contains a presentation timestamp. This timestamp will be used as
|
||||
the timestamp for the Matroska Block.</p>
|
||||
|
||||
<p>A Segment is normally shown until a subsequent Segment is encountered. Therefore the Matroska Block
|
||||
<strong>MAY</strong> have no Duration. In that case, a player <strong>MUST</strong> display a Segment within a Matroska Block
|
||||
until the next Segment is encountered.</p>
|
||||
|
||||
<p>A muxer <strong>MAY</strong> use a Duration, e.g., by calculating the distance between two subsequent Segments.
|
||||
If a Matroska Block has a Duration, a player <strong>MUST</strong> display that Segment only for
|
||||
the duration of the Block’s Duration.</p>
|
||||
|
||||
<h2 id="hdmv-text-subtitles">HDMV text subtitles</h2>
|
||||
|
||||
<p>The specifications for the HDMV text subtitle format (short: HDMV
|
||||
TextST) can be found
|
||||
in the document “Blu-ray Disc Read-Only Format; Part 3 — Audio Visual
|
||||
Basic Specifications” in section 9.15 “HDMV text subtitle streams”.</p>
|
||||
|
||||
<h3 id="storage-of-hdmv-text-subtitles">Storage of HDMV text subtitles</h3>
|
||||
|
||||
<p>The CodecID to use is <code class="language-plaintext highlighter-rouge">S_HDMV/TEXTST</code>.</p>
|
||||
|
||||
<p>A CodecPrivate Element is required. It <strong>MUST</strong> contain the stream’s Dialog Style Segment
|
||||
as described in section 9.15.4.2 “Dialog Style Segment” of the Blu-ray specifications.</p>
|
||||
|
||||
<h4 id="storage-of-hdmv-textst-dialog-presentation-segments-in-matroska-blocks">Storage of HDMV TextST Dialog Presentation Segments in Matroska Blocks</h4>
|
||||
|
||||
<p>Each HDMV Dialog Presentation Segment (short: Segment) will be stored in a Matroska Block.
|
||||
A Segment is the data structure described in section 9.15.4.3 “Dialog presentation segment”
|
||||
of the Blu-ray specifications.</p>
|
||||
|
||||
<p>Each Segment contains a start and an end presentation timestamp (short: start PTS & end PTS).
|
||||
The start PTS will be used as the timestamp for the Matroska Block. The Matroska Block <strong>MUST</strong>
|
||||
have a Duration, and that Duration is the difference between the end PTS and the start PTS.</p>
|
||||
|
||||
<p>A player <strong>MUST</strong> use the Matroska Block’s timestamp and Duration instead of the Segment’s
|
||||
start and end PTS for determining when and how long to show the Segment.</p>
|
||||
|
||||
<h4 id="character-set">Character set</h4>
|
||||
|
||||
<p>When TextST subtitles are stored inside Matroska, the only allowed character set is UTF-8.</p>
|
||||
|
||||
<p>Each HDMV text subtitle stream in a Blu-ray can use one of a handful of character sets.
|
||||
This information is not stored in the MPEG2 Transport Stream itself but in the accompanying Clip Information file.</p>
|
||||
|
||||
<p>Therefore a muxer <strong>MUST</strong> parse the accompanying Clip Information file. If the information
|
||||
indicates a character set other than UTF-8, it <strong>MUST</strong> re-encode all text Dialog Presentation Segments
|
||||
from the indicated character set to UTF-8 prior to storing them in Matroska.</p>
|
||||
|
||||
<h2 id="digital-video-broadcasting-dvb-subtitles">Digital Video Broadcasting (DVB) subtitles</h2>
|
||||
|
||||
<p>The specifications for the Digital Video Broadcasting subtitle bitstream format (short: DVB subtitles)
|
||||
can be found in the document “ETSI EN 300 743 - Digital Video Broadcasting (DVB); Subtitling systems”.
|
||||
The storage of DVB subtitles in MPEG transport streams is specified in the document
|
||||
“ETSI EN 300 468 - Digital Video Broadcasting (DVB); Specification for Service Information (SI) in DVB systems”.</p>
|
||||
|
||||
<h3 id="storage-of-dvb-subtitles">Storage of DVB subtitles</h3>
|
||||
|
||||
<h4 id="codecid">CodecID</h4>
|
||||
|
||||
<p>The CodecID to use is <code class="language-plaintext highlighter-rouge">S_DVBSUB</code>.</p>
|
||||
|
||||
<h4 id="codecprivate">CodecPrivate</h4>
|
||||
|
||||
<p>The CodecPrivate element is five bytes long and has the following structure:</p>
|
||||
|
||||
<ul>
|
||||
<li>2 bytes: composition page ID (bit string, left bit first)</li>
|
||||
<li>2 bytes: ancillary page ID (bit string, left bit first)</li>
|
||||
<li>1 byte: subtitling type (bit string, left bit first)</li>
|
||||
</ul>
|
||||
|
||||
<p>The semantics of these bytes are the same as the ones described in
|
||||
section 6.2.41 “Subtitling descriptor” of ETSI EN 300 468.</p>
|
||||
|
||||
<h4 id="storage-of-dvb-subtitles-in-matroska-blocks">Storage of DVB subtitles in Matroska Blocks</h4>
|
||||
|
||||
<p>Each Matroska Block consists of one or more DVB Subtitle Segments as described
|
||||
in segment 7.2 “Syntax and semantics of the subtitling segment” of ETSI EN 300 743.</p>
|
||||
|
||||
<p>Each Matroska Block <strong>SHOULD</strong> have a Duration indicating how long the DVB Subtitle Segments
|
||||
in that Block <strong>SHOULD</strong> be displayed.</p>
|
||||
|
||||
<h2 id="arib-isdb-subtitles">ARIB (ISDB) subtitles</h2>
|
||||
|
||||
<p>The specifications for the ARIB B-24 subtitle bitstream format (short: ARIB subtitles)
|
||||
and its storage in MPEG transport streams can be found in the documents
|
||||
[@!ARIB.STD-B24], [@!ARIB.STD-B10], and [@!ARIB.TR-B14].</p>
|
||||
|
||||
<h3 id="storage-of-arib-subtitles">Storage of ARIB subtitles</h3>
|
||||
|
||||
<h4 id="codecid-1">CodecID</h4>
|
||||
|
||||
<p>The CodecID to use is <code class="language-plaintext highlighter-rouge">S_ARIBSUB</code>.</p>
|
||||
|
||||
<h4 id="codecprivate-1">CodecPrivate</h4>
|
||||
|
||||
<p>The CodecPrivate element is three bytes long and has the following structure:</p>
|
||||
|
||||
<ul>
|
||||
<li>1 byte: component tag (bit string, left bit first)</li>
|
||||
<li>2 bytes: data component ID (bit string, left bit first)</li>
|
||||
</ul>
|
||||
|
||||
<p>The semantics of the component tag are the same as those described in
|
||||
[@!ARIB.STD-B10], part 2, Annex J.
|
||||
The semantics of the data component ID are the same as those described
|
||||
in [@!ARIB.TR-B14], fascicle 2, Vol. 3, Section 2, 4.2.8.1.</p>
|
||||
|
||||
<h4 id="storage-of-arib-subtitles-in-matroska-blocks">Storage of ARIB subtitles in Matroska Blocks</h4>
|
||||
|
||||
<p>Each Matroska Block consists of a single synchronized PES data structure as described in
|
||||
chapter 5 “Independent PES transmission protocol” of [@!ARIB.STD-B24], volume 3, with a
|
||||
Synchronized_PES_data_byte block containing one or more ISDB Caption Data Groups as described
|
||||
in chapter 9 “Transmission of caption and superimpose” of [@!ARIB.STD-B24], volume 1, part 3.
|
||||
All of the Caption Statement Data Groups in a given Matroska Track <strong>MUST</strong> use the same language index.</p>
|
||||
|
||||
<p>A Data Group is normally shown until a subsequent Group provides instructions to clear it.
|
||||
Therefore the Matroska Block <strong>SHOULD NOT</strong> have a Duration.
|
||||
A player <strong>SHOULD</strong> display a Data Group within a Matroska Block until its internal duration elapses,
|
||||
or until a subsequent Data Group removes it.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer id="footer" class="site-footer region region-footer">
|
||||
<div id="block-block-1" class="block block-block first last odd">
|
||||
<p class="rtecenter" style="font-size: smaller">
|
||||
<b>Copyright ® 2005 - 2020 Matroska (non-profit org), All Rights Reserved.</b>
|
||||
|
|
||||
<a href="https://www.matroska.org/imprint.html">Imprint/Impressum</a>
|
||||
|
|
||||
<a href="https://www.matroska.org/data_protection_policy.html">Data Protection Policy/Datenschutzerklärung</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
</body><script src="Subtitles_files/passkeys.js"></script></html>
|
||||
Reference in New Issue
Block a user