Re: Problems with matroska parser filter output pin : its unable to call dvobsub

"Pamel" <[email protected]> Tue, 13 May 2003 17:27:36 -0500
Newsgroups gmane.comp.multimedia.matroska.devel,gmane.comp.multimedia.matroska.user,gmane.comp.multimedia.usf.devel
Message-ID <[email protected]>
"Gabest" <[email protected]> wrote
> > In my opinion the best way to resolve the problem would be to use a new
> > subtitle MEDIATYPE (or SUBTYPE maybe). It will also make possible to
> > distingish subtitles format.
>
> That's an excellent idea, needed to be done to ogm long ago
> too. I suggest using a format, what I also forced into avi :), where there
> is only one sample containing the whole subtitle file. To save more space
it
> could be compressed with some lzw coding (I have the source of an gif
codec
> here somewhere which I made years ago, it is quite simple and short). Or
> alternatively, the format block of each sample could tell about the global
> style and other info in a predefined structure (more specs to be done,
> hehe), and the raw text could have some kind of style mod tags stuffed in
> it, but I hate html tags.. they are a pain to parse.

I think I should comment here.  There is a very specific way that subtitles
are supposed to be stored in Matroska.  Each set of words with a timecode is
supposed is supposed to be stored by itself in a block.  The timecode of the
block is the timecode that the subtitle is supposed to appear.  The duration
that the subtitle is supposed to be on the screen is stored in an element
known as BlockDuration.  Information that is to be applied to the subtitle
track in general goes in the CodecPrivateData.

To illustrate this, I will use USF as an example.  Here is some example USF
code:

<USFSubtitles version="1.0">
  <metadata>
    <title>The Core Media Player subtitle format sample</title>
      <author>
        <name>[Toff]</name>
        <email>[email protected]</email>
        <url>http://christophe.paris.free.fr</url>
      </author>
      <language code="en">English</language>
      <date>2002-08-15</date>
      <comment>This is a sample</comment>
  </metadata>

  <styles>
    <style name="NarratorSpeaking">
      <fontstyle italic="yes" color="#FFEEEE" outline-color="#FF4444"/>
    </style>
  </styles>

  <subtitles>
    <subtitle start="00:00:11.000" stop="00:00:15.000">
      <text style="NarratorSpeaking">What can be done ?</text>
    </subtitle>
  </subtitles>
</USFSubtitles>


In this example, the Metadata would be stripped and placed in the native
Matroska tags.  The Styles would be stripped and placed in the
CodecPrivateData.  The subtitle Start time would be stripped and placed in
the Blocks timecode.  The Stop time would be stripped and used to calculate
the BlockDuration.

When the file is loaded into a player, all of the Metadata is available as
track information.  The CodecPrivateData is sent to the codec so that is
knows how to render all of the styles.  When a subtitle block is sent to the
codec, it renders the subtitle using the appropriate Style that it has
already loaded.  Then the subtitle is displayed at the correct time, for the
correct duration.  Extremely complex subtitle systems that have dependancies
on other subtitles can use the ReferenceBlock element to ensure that the
other subtitle is loaded first.

The reason for this is that it ensures that a Matroska editor doesn't need
to have a working knowledge of whatever subtitle system is being used.  For
instance, if you had a movie with subtitles, you could cut out a clip from
the middle and it would remove the video frames, audio frames, and
subtitles, and everything would stay in synch.  You could even change the
speed of the movie and only need to reencode the audio, the video and
subtitles would just need the timecode and Blockduration of the block
changed.  In fact, most editing for Matroska could be done by an editor that
did not have to be able to decode any video, audio, or subtitle data, as
long as it was all stored in the proper manner.

> > We must also define a way to inform dvobsub of the language used or if a
> > subtitle stream must always be displayed (like closed caption).
>
> This should go into the format block.

This would actually go in the Language element for the Track.

> > With the flexibility of matroska we need to re-think how subtitles are
> > handled :)
>
> "Think! Think! Think!" - Winnie The Pooh :)

Most of this has already been thought out.  Now it just needs to be properly
implemented.


Pamel



http://www.matroska.org