[whatwg] Fwd: Discussing WebSRT and alternatives/improvements
philipj at opera.com
Wed Aug 25 07:39:45 PDT 2010
On Wed, 25 Aug 2010 14:39:00 +0200, Silvia Pfeiffer
<silviapfeiffer1 at gmail.com> wrote:
> On Wed, Aug 25, 2010 at 7:20 PM, Philip Jägenstedt
> <philipj at opera.com>wrote:
>>>> The question, then, is if parsers that handle the mentioned markup
>>>> ignore <1>, <ruby> and <rt>. I haven't tested it, but I assume that
>>>> will ignore it and some won't. How many percent of the media player
>>>> would have to handle this correctly for these extensions to be OK, in
>>> If a single one breaks, it would be bad IMO because the expectations of
>>> users of that software will be broken even if it may just be a small
>>> percentage of users and we have no influence on the upgrade path of
>>> software - in particular if it is proprietary.
>> Neither a new file extension, MIME type or header is enough to stop some
>> implementations from treating it as SRT and break. The only remaining
>> option, AFAICT, is making the format fundamentally incompatible with
>> SRT. Is
>> it worth it?
> If it has a different file extension and a different mime type and even a
> different header, I don't think any existing software will open it as
> Why would it think that a random file is a SRT file? It would need to be
> application that accepts absolutely anything that you give it as SRT and
> then that software has more fundamental problems.
I renamed a SRT file to .wsrt and added WEBSRT on a line before the cues
and it still plays just fine in MPlayer, using `mplayer video.ogv -sub
subs.wsrt`. VLC won't open a subtitle file with .wsrt extension, but the
same file (with a WEBSRT header) works with the extension srt or txt.
Totem is the other way around, the file extension doesn't matter, but it
rejects files with a header.
The results are hardly consistent, but at least one player exist for which
it's not enough to change the file extension and add a header. If we want
to make sure that no content is treated as SRT by any application, the
format must be more incompatible.
>>>> At this point, what is your recommendation? The following ideas have
>>>> on the table:
>>>> * Change the file extension to something other than .srt.
>>>> I don't have an opinion, browsers ignore the file extension anyway.
>>> Yes, I think we should definitely have a new file extension.
>> I'll leave this to others to decide, but since browsers have no concept
>> file extensions, just using .srt will work. If the format is SRT-like
>> likely at least some files will use .srt in practice.
> All SRT files in practice use the .srt extension - it is typically how
> formats are identified by applications. Just because *nix ignores file
> extensions mostly for identifying file types doesn't mean that
> do. Again, I believe strongly that re-using the same file extension is
> one biggest pain we can inflict on the community.
As shown above, several popular (?) media players ignore or give little
weight to the file extension.
>> * Change the MIME type to something other than text/srt.
>>>> I doubt it makes any difference, as most software that deal with SRT
>>>> have no concept of MIME types. No matter what I'd want exactly 1 MIME
>>>> or alternatively make browsers ignore the MIME type completely.
>>> You're right in that existing SRT software probably doesn't deal much
>>> SRT mime type. Right now text/x-srt or text/srt is sometimes used for
>>> files, but often text/plain is also in use and more likely from a Web
>>> server. Since this is the space where Web browsers play, I am not
>>> fussed, though I think logically text/websrt makes more sense with a
>>> extension. Then, also SRT files can be served as text/websrt to allow
>>> to take part in the WebSRT infrastructure if indeed they will continue
>>> valid WebSRT files.
>> Is there anything you expect would break if WebSRT files were served as
> I'm asking because I don't know how anal Web browsers are about mime
> I would think a Web browser should accept WebSRT and SRT files in
> format as well as WebSRT files in text/websrt format and SRT files in
> text/srt format. Would something break if they even came as text/html? I
> would expect that it makes a difference when these are loaded directly
> as a
> resource for display (e.g. when you directly go to
> http://example.com/mycaptions.wsrt), but not when used through a <track>
> element, where WebSRT is the baseline format and thus is expected.
It's actually easier for a browser to ignore the MIME type than it is to
be strict about it, at least when the format is easily identified by
sniffing (sniffing code is needed anyway for local files). WebSRT isn't
very easy to sniff, so that would be an argument in favor of a mandatory
The main reason to care about the MIME type is some kind of "doing the
right thing" by not letting people get away with misconfigured servers.
Sometimes I feel it's just a waste of everyone's time though, it would
generally be less work for both browsers and authors to not bother.
>> * Add a header to WebSRT to make it uniquely identifiable.
>>>> The header would have to be mandatory and browsers would have to
>>>> files that don't have it. Such files would be compatible with some
>>>> software and break some, depending on how they sniff. We could also
>>>> metadata in such a header.
>>> Yes, I think we need to introduce a header. Maybe we can hide all the
>>> structure in what SRT recognizes as comments (i.e. start the lines as
>>> But I believe we need some hints like the @profile to identify the
>>> type of
>>> the cues and the <link> to link to a style sheet, and we need metadata
>>> the <meta> element of HTML headers.
>> I had no idea that semicolon was used for comments in SRT, is this usage
>> widespread? Does it work in most players?
> I thought it was, but maybe it was just introduced for WebSRT. It is not
> tested in Hixie's SRT research. Can you take a quick look through your
> SRT file collection if there are any? I'm probably wrong about this
> as it's not mentioned in the wiki page for SRT .
>  http://wiki.whatwg.org/wiki/SRT_research
>  http://en.wikipedia.org/wiki/SubRip
OK, I grepped the 10000 files. Only 15 had any lines beginning with a
semicolon, and by manual inspection it doesn't look like any of them are
clearly intended as comments (it's hard to tell, all are in foreign
languages). None of them were at the very beginning of the file.
>> * Make something deliberately incompatible with SRT.
>>>> It doesn't make a big difference to browsers implementing the format.
>>>> be replacing something that mostly works in existing players with
>>>> that never works.
>>> That was the idea of WMML and I took that path because I thought it
>>> advantageous for other Web applications, such as built on libxml2,
>>> php's SimpleXML, pyexpat for python, Nokogiri for ruby etc. But I
>>> like the idea of WebSRT to allow arbitrary metadata in the cues without
>>> having to put it into CDATA sections.
>>> I don't mind creating a format that is still somewhat compatible with
>>> We don't have to force incompatibility - but we should also not have it
>>> restrict us. In either case, it is a new format.
>> I'm not trying to be annoying, but this seems to clash with your
>> to not break any existing software. Anything that resembles SRT *will*
>> treated as SRT in some existing players.
> No, I think that's a misconception. I think most players test the file
> extension and maybe the mime type before opening a file as srt. A quick
> in VLC on my Mac shows that when I go to "Subtitle -> Open File" I am not
> allowed to open anything that doesn't have an extension that VLC accepts
> they get filtered out. Thus, what the actual file looks like really
> matter - what matter is what it sells itself as through the file
> the mime type, or some magic identifier at the beginning of the file.
> is used depends on your OS and your application.
Some application use the file extension, some rely on sniffing and at
least GStreamer (and thus Totem) weighs both of these together.
I think we've made some interesting finds in this thread, but we're
starting to go in circles by now. Perhaps we should give it a rest until
we get input from a third party. A medal to anyone who has followed it
this far :)
More information about the whatwg